Thursday, 15 July 2010

Extract Individual Line Segment Coordinates from Boundary Image - MATLAB -



Extract Individual Line Segment Coordinates from Boundary Image - MATLAB -

i have matlab script gives me boundary lines of image using bwboundaries(). now, after plotting image, getting finish image, formed various straight line segments. coordinates or show individual line segments form boundary.

i think method called digital straightness of lines, want know how apply here in case.

[b,l,n] = bwboundaries(z,'noholes'); k=1:length(b), boundary = b{k}; if(k > n) figure, plot(boundary(:,2),boundary(:,1),'g','linewidth',2); else figure, plot(boundary(:,2),boundary(:,1),'r','linewidth',2); end end

according understanding of question,my thought utilize bwtraceboundary().

bw = imread('image.png'); imshow(bw,[]); r = 165; % can r , c image using "impixelinfo" c = 43; contour = bwtraceboundary(bw,[r c],'w',4,inf,'counterclockwise'); hold on; plot(contour(:,2),contour(:,1),'g','linewidth',2); x=contour(:,2)' y=contour(:,2)'

am answering question?

matlab image-processing matlab-figure

No comments:

Post a Comment