Finding a area of image using coordinates.

1 次查看(过去 30 天)
if L == 1
Q = regiongrowing(im2double(im9), 5,5,0.1);
else
[m, n] = size(im9);
Q = regiongrowing(im2double(im9), 7 , n-7, 0.1);
end
Q1 = im2uint8 (Q);
Q2 = imsubtract(im7,Q1);
Q3 = edge(Q2, 'Roberts');
[x, y] = find(Q3 == 1);
cY = mode(y);
cX = mode(x);
if L == 1
Q3(1:cX,:) = zeros(size(Q3(1:cX,:)));
Q3(:,1:cY) = zeros(size(Q3(:,1 :cY)));
else
Q3 (1:cX,:) = zeros(size(Q3(1:cX,:)));
Q3 (:,cY:n) = zeros(size(Q3(:,cY:n)));
end
Q3 = im2uint8(Q3);
edgeim = edge(Q3,'canny', [0.5 0.8], 8);
figure, imshow(edgeim);
[x,y] = find(edgeim == 1);
p = polyfit(x,y,2);
x1 = 1: 210;
y1 = polyval(p,x1);
plot(x1,y1);
rgbIm7 = ind2rgb(im7,colormap);
figure; imshow(rgbIm7);
x2 = x1(find(y1 >=0));
y2 = y1(find(y1>=0));
for i = 1: length(x2)
end;
y2 = round(y2);
rgbIm7(1,1,1)=1;
for i = 1: length(x2)
yp = round(y2(i));
if yp==0
yp = 1;
end;
rgbIm7(x2(i),yp,1)=1;
end;
figure; imshow(rgbIm7);
how do you find the area from a part of the image using coordinates? Thank you in advance

回答(1 个)

Image Analyst
Image Analyst 2011-10-7
Try the polyarea() function.

Community Treasure Hunt

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

Start Hunting!

Translated by