How can i pass 'MinSize' and 'MaxSize' name-value pairs into the object's constructor?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am using cascade object detector, and i want to pass a minsize and maxsize but i don't know how to implement it in my matlab code
For minsize For h=w=20
[ h w]=MinSize(I) MinSize(h/4, w/4)=x MinSize[x x]
And for max
MaxSIze(h,w)=y MaxSize[y y]
4 Commenti
Geoff Hayes
il 13 Giu 2014
What have you attempted so far? What do you want h and w to vary between?
Risposta accettata
dpb
il 13 Giu 2014
Modificato: dpb
il 15 Giu 2014
I've no clue on what vision.CascadeObjectDetector is, but
faceDetector = vision.CascadeObjectDetector( h=20,w=20, ...
[h w]=MinSize(test_image), ...
MinSize(h/4, w/4)=x, ...
'MinSize'[20, 20]);
isn't even close to any recognizable Matlab syntax. An assignment inside an argument list is verboten entirely, and the object will accept only whatever named parameters it's been coded to accept in the form it expects.
As the doc indicates, the 'MinSize' parameter is a 2-vector so it would be something like
faceDetector = vision.CascadeObjectDetector('MinSize',[20 20], ...
You can include previously defined variables and computations in the creation of the values, but the results have to be written as vectors or scalars depending on the parameter with which they're being associated.
for details altho I agree it could stand with a few examples. It presumes the reader has enough experience with basic Matlab that he understands implicitly what is meant by the phrase "specify these properties as one or more name-value pair arguments".
ADDENDUM
I hadn't seen the previous. In this case you can have your cake and eat it too... :)
IFF MinSize is a function which returns a 2-vector, then you can write
[h w]=MinSize(I);
faceDetector = vision.CascadeObjectDetector('MinSize',[h/4 w/4], ...
which is equivalent to
faceDetector = vision.CascadeObjectDetector('MinSize',[h w]/4, ...
and you can even dispense with the intermediary variables if they're not needed elsewhere--
faceDetector = vision.CascadeObjectDetector('MinSize',MinSize(I)/4, ...
The latter takes advantage of the definition of MinSize as being the vector of length two required. Similarly for the other parameters.
Oh, one last minor pertubation--
If you were to want different scaling for the two values it would still be possible with some care--
% make minimum h==2w
faceDetector = vision.CascadeObjectDetector('MinSize',MinSize(I)./[2 4], ...
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su C4ISR in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!