How can i find distance between two subtracted bwboundry image like (imean, jmean)?

조회 수: 1 (최근 30일)
Hi, i am doing an experimental study with a vision camera. There are two metal plate and i want to measure the gap between these two plates. I can subtract the edges with a selection ROI and then unfill command to clear my image...You can find an initial and after run photo with the links below:
After that, i need to find mean value of x-y pixels of black gap...Here is the ROI part...
s=imread('gap1.jpg');
I=rgb2gray(s);
BW = roipoly(I);
% manually select region here
BW1 = not(BW);
J = roifill(I,BW1); imshow(J)
Y = medfilt2(J,[10 10]); %filter the noise %best result
BWs = edge(Y, 'sobel', (graythresh(J) * .15));
cr=[ 50, 50, 400, 300];
I2 = imcrop(BWs,[cr]);
figure, imshow(I2), title('binary gradient mask');

채택된 답변

Image Analyst
Image Analyst 2014년 6월 21일
Just threshold, find the area, and divide by the number of rows. The attached m-file will create this:
  댓글 수: 1
Emre
Emre 2014년 6월 23일
thank you for your quick answer, but i would ask one more thing...
What about if i want to get max and min [Width(imin,imax)]?
cause i want to draw a plot in a roi about min,max width change...

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by