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 Comments

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?
Not really i just attached my m file..the error is on line 39

Sign in to comment.

 Accepted Answer

...
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 Comments

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]);
...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?
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
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);
I repeat
What does
which MinSize
return?
I want it to return the height and width of the smallest and largest object i want it to detect
Again I repeat -- type in
which MinSize
at the command line and report...
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.
Thank you for the help but it was not the files missing. It was just because i didn't round it.
Say what!!!!????

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 16 Jun 2014

Commented:

dpb
on 16 Jun 2014

Community Treasure Hunt

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

Start Hunting!