I=imread('P3290337.JPG');
I=padarray(I,[1 1 0],0);
thresh = 15;
mask = ~(I(:,:,1) < thresh & I(:,:,2) < thresh & I(:,:,1) < thresh);
xProj = any(mask);
xMin = find(xProj,1,'first')-0.5;
xMax = find(xProj,1,'last');
yProj = any(mask,2);
yMin = find(yProj,1,'first');
yMax = find(yProj,1,'last');
imshow(I);
hold on
plot([xMin xMin],ylim,'r','LineWidth',2)
plot([xMax xMax],ylim,'r','LineWidth',2)
plot(xlim,[yMin yMin],'r','LineWidth',2)
plot(xlim,[yMax yMax],'r','LineWidth',2)
2 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/279133-find-the-actual-distances-in-an-image#comment_359011
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/279133-find-the-actual-distances-in-an-image#comment_359011
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/279133-find-the-actual-distances-in-an-image#comment_359036
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/279133-find-the-actual-distances-in-an-image#comment_359036
Sign in to comment.