Azzera filtri
Azzera filtri

issue with MATLAB Coder and cell arrays

1 visualizzazione (ultimi 30 giorni)
Daniel Vieira
Daniel Vieira il 6 Apr 2017
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
if ~isempty(fBox)
for k=1:size(fBox,1)
if ~isempty(fBox)
for k=1:size(fBox,1)
if ~isempty(HT)

Risposte (1)

Tony Mohan Varghese
Tony Mohan Varghese il 22 Mar 2018
Solutions :
  • Use recognized pattern for assigning elements
  • Use repmat
  • Use coder.nullcopy


Scopri di più su MATLAB Coder in Help Center e File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by