필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can any one help me to correct this code??

조회 수: 1 (최근 30일)
Pamela Paolo
Pamela Paolo 2012년 10월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, to find regions having the higher MeanIntesity compared to the MeanIntesity of its edge, I used this line but I got an error. thank you for helping me to find the right solution.
image=imhmin(I,4,8);
edg = edge(image,'log',0);
m1 = bwmorph(edg,'spur');
m2 = bwmorph(m1,'hbreak');
I2=imfill(m2,'holes');
holes = I2 & ~m2;
imagebin1 = bwlabel(holes,8);
imggris1=I;
imggris1 (imagebin1 ==0)=255;
imagebin2 = edge(imggris1,'log',0);
imggris2=I;
imggris2(imagebin2==0)=255;
ad = regionprops(imagebin1, imggris1, 'MeanIntensity');
det = regionprops(imagebin2, imggris2, 'MeanIntensity');
feim = find([ad.MeanIntensity]>[det.MeanIntensity]);
The error:
??? Error using ==> gt
Matrix dimensions must agree.
Error in ==> detect_fea at 41
feim = find([ad.MeanIntensity]>[det.MeanIntensity]);

답변 (3개)

Matt J
Matt J 2012년 10월 15일
편집: Matt J 2012년 10월 15일
[ad.MeanIntensity] and [det.MeanIntensity] at line 41 of detect_fea are not the same size. The operation [ad.MeanIntensity]>[det.MeanIntensity] requires that they both be the same size or one of them be a scalar.
Use the DSTOP command or breakpoints to pause your code at line 41 to examine what happened. Apparently, though, regionprops did not find the same number of regions in both ad and det.

Image Analyst
Image Analyst 2012년 10월 15일
For some reason you don't have as many blobs in ad as you do in det.

Pamela Paolo
Pamela Paolo 2012년 10월 15일
편집: Pamela Paolo 2012년 10월 15일
Hi regionprops didn't find the same number of regions in both ad and det
I tried to do this
m=numel(ad)
p=numel(det)
the result is:
m =
247
p =
228
But how can i solve this problem please because i think that it is caused by regions in the red recatangles marqued in this image http://www.imagup.com/data/1164970539.html
  댓글 수: 2
Pamela Paolo
Pamela Paolo 2012년 10월 15일
편집: Pamela Paolo 2012년 10월 15일
How can i correct my code to avoid this mismatch of the number of regions??
Image Analyst
Image Analyst 2012년 10월 15일
I wouldn't even do it like that. I'd use bwperim as a mask to get the outer layer of your blobs. I think with bwperim you should have the same number of blobs.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by