How can i define MinSize, i am getting an error?

When i try to pass a MinSize i am getting an error like i=this one below..How can i fix it?
Undefined function 'MinSize' for input arguments of type 'struct'.
Thank you

2 件のコメント

Geoff Hayes
Geoff Hayes 2014 年 6 月 16 日
Based on the error message, it seems that you are trying to use something called MinSize as a function and are passing a struct to it. The following code generates the same error
x.a = 42;
MinSize(x);
Given that there is no MinSize function, then this error message makes sense. Is this similar to what you are attempting?
Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
Not really i just attached my m file..the error is on line 39

サインインしてコメントする。

 採用された回答

dpb
dpb 2014 年 6 月 16 日

1 投票

...
I= dir([image_path,'*.jpg']);
[h w]=MinSize(I);
...
Of course you got the error-- I is the directory structure returned by dir, you've not loaded an image.

11 件のコメント

Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
Even when i change it, it still gives me the same error..is this right?
I=im2double(imread([image_path,img_list(i).name])); imshow(I);hold on; [h w]=MinSize(I); faceDetector = vision.CascadeObjectDetector('MinSize',[h w]/4);
faceDetector = vision.CascadeObjectDetector('MaxSize',[h w]);
dpb
dpb 2014 年 6 月 16 日
...Even when i change it, it still gives me the same error..is this right?
Clearly not if it errors but you didn't give the error so what are we to do?
This obviously is something you got from somewhere else; did you download the full package?
What does
which MinSize
return?
Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
Yes i did, Is there a problem that i download it from somewhere else???? I am using an opencv code but i want to change some part of it because the for their face alignment they are using a fixed min and max size of the face to detect but i want to change it thats why.
I want to set h=w=20
Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
And even when i load the images i got the same error that's why i didn't write it..it was
Undefined function 'MinSize' for input arguments of type 'double'.
Error in Demo (line 38) [h w]=MinSize(I);
dpb
dpb 2014 年 6 月 16 日
編集済み: dpb 2014 年 6 月 16 日
I repeat
What does
which MinSize
return?
Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
I want it to return the height and width of the smallest and largest object i want it to detect
dpb
dpb 2014 年 6 月 16 日
Again I repeat -- type in
which MinSize
at the command line and report...
Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
It says not found!
dpb
dpb 2014 年 6 月 16 日
編集済み: dpb 2014 年 6 月 16 日
Which is what I expected. You didn't download all the supporting routines to go with the top level function. Go back to wherever/whomever you got the code and get the other supporting functions to go with what you do have.
Or, on second look at the code you posted -- what have you modified in that? It looks based on the indention that perhaps you've added the lines
faceDetector = vision.CascadeObjectDetector;
%faceDetector = vision.CascadeObjectDetector('MinSize',[20 20]);
I= dir([image_path,'*.jpg']);
[h w]=MinSize(I);
...
??? It doesn't look like that belongs where it is--there's an earlier dir then a loop processing the return from it and then this new call to dir inside there that kinda' wipes out everything else.
Was there even any reference to this MinSize function at all or did you just insert it hoping magic would happen?
If you expect it to "return the height and width of the smallest and largest object i want it to detect", you're going to have to somehow define that--it's not going to be able to pluck those from the aether by clairvoyance.
Misrak Seifu
Misrak Seifu 2014 年 6 月 16 日
Thank you for the help but it was not the files missing. It was just because i didn't round it.
dpb
dpb 2014 年 6 月 16 日
Say what!!!!????

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2014 年 6 月 16 日

コメント済み:

dpb
2014 年 6 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by