How can i pass 'MinSize' and 'MaxSize' name-value pairs into the object's constructor?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
dpb
2014년 6월 13일
편집: dpb
2014년 6월 15일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!