- Use recognized pattern for assigning elements
- Use repmat
- Use coder.nullcopy
issue with MATLAB Coder and cell arrays
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I wrote a code to track multiple faces, and I'm trying to put it on a raspberry pi. I solved every issue pointed by the Coder except one: "Unable to determine that every element of HT{:} is assigned before this line"
I read about this error, but as far as I can see there is no problem with the code. The (shortened) code is below. In the code, n is a loop counter, FT is a vision.CascadeObjectDetector, HTbase (and consequently every element of HT) is a vision.HistogramBasedTracker object, frame and hsvFrame are the image in rgb (all channels) and hsv (first channel) formats. Both HT and HTbase are declared as persistent. The idea is that once every 12 frames (first if) the code searches for faces with the actual face tracking object (slow but precise); using this result, in every other frame the code will just look for a matching hue too keep track (less precise but computationally faster). But in the line "hBox=HT{k}(hsvFrame);" the coder accuses that error and it doesn't make sense. The assignment of HT once every 12 frames already fills all cells, and in the others it should use its stored values (because they are persistent, right?).
so, any hints on what I'm missing?
if rem(n,12)==1
fBox=FT(frame);
if ~isempty(fBox)
HT=cell(size(fBox,1),1);
for k=1:size(fBox,1)
HT{k}=HTbase;
initializeObject(HT{k},hsvFrame,fBox(k,:));
end
end
end
if ~isempty(fBox)
for k=1:size(fBox,1)
if ~isempty(HT)
hBox=HT{k}(hsvFrame);
end
...
end
end
0 Commenti
Risposte (1)
Tony Mohan Varghese
il 22 Mar 2018
Solutions :
0 Commenti
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!