I have an image with 2 edges
if I then plot the boundary of the edges with the code below:
imshow(I); hold on; [B,L,N] = bwboundaries(I);
for k=1:length(B),
boundary = B{k};
BL=size(boundary);
plot(boundary(1,2), boundary(1,1), '*g','MarkerSize',15);
for j=1:10:BL(1)
plot(boundary(j,2), boundary(j,1), '.r','MarkerSize',5);
end
end
As seen in the image above, the starting point (the green star) for the left edge is at the left side of the image, which is what I expected. However, the starting point for the right edge is towards the middle
Apparently this is because bwboundaries
deals with tracing objects in clockwise direction, whereas the 2nd edge needs to be traced counterclockwise for it to begin and end on the right boundary of the image
How can Matlab be able to take the positions from bwboundaries
and correctly determine the endpoints for the edge on the right?