필터 지우기
필터 지우기

What the problem with this code of cropping image ?

조회 수: 2 (최근 30일)
M.aM
M.aM 2012년 7월 26일
Hi all
I have apply this code to crop my images in any sizes
B = imread('bar5.jpg');
B = imresize(B,0.33);
B2 = im2bw(B1);
stat = regionprops(I,'area');
C(1:length(stat)) = stat(1:end).Area;
m = max(C);
J = bwareaopen(I,m);
imshow(J);
and I got this message
??? Undefined function or variable 'I'.
so any ideas
sorry I'm new in matlab
I want learning
Thanks

채택된 답변

Walter Roberson
Walter Roberson 2012년 7월 26일
After the line
B2 = im2bw(B1);
add the line
I = B2;

추가 답변 (2개)

M.aM
M.aM 2012년 7월 26일
Thank you Walter but why it did not cropped image do you know? should I put the size of image ??? but I need it to apply for unknown image Thanks once again
  댓글 수: 1
Ryan
Ryan 2012년 7월 27일
편집: Ryan 2012년 7월 27일
There is nothing in the code to suggest the image was cropped in any way, just resized.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2012년 7월 27일
You can do this:
stat = regionprops(B2,'area');
allAreas = [stat.Area];
maxAreas = max(allAreas);
You didn't do any cropping (perhaps you meant "size filtering" instead). You just took your image and threw away all the objects smaller than the largest object by using bwareaopen(). In other words, you threw EVERYTHING away.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by