Efficient way to determine longest edge in an image

I am working on a set of images, and as an intermediate step, I need to determine the longest edge in a 2-dimensional image. The original image has been subjected to canny edge detection. What could be the best way to do this... I tried going through the entire image marking every edge with different pixel values to differentiate them and keeping the maximum length stored. This seems to be failing due to some reason. I have to implement this in C++, is there a better way to do this?

Thank you in advance
Hi,

I am not sure if you have the coordinates for each vertex, if so I would use hypot(xdiff,ydiff) to
get the length of each edge.

if not I would count the number of pixels in the x direction and y-direction and then
calculate the result with hypot.

1
2
3
4
5
  x
 x
 x 
x


would be 3 in x dir and 4 in y sorry i cant explain it clearer

hope this helps
Shredded
Topic archived. No new replies allowed.