Ask Your Question
1

distance measurement

asked 2013-06-24 05:58:38 -0600

sravanthi gravatar image

Hi,

I would like to find the distance between a colored dot to an edge in an image. How do I proceed with this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-06-24 07:01:48 -0600

Guanta gravatar image

updated 2013-06-24 07:04:37 -0600

Find the position of the colored dot in the image, e.g. by thresholding / template-matching. Having its x and y coordinate you can get the distances to the image edges easily: left_dist = x, right_dist = image.cols-1-x, upper_dist = y, lower_dist = image.rows-1-y. The Euclidian distance between two points 'pos' and 'other' in general is sqrt( (pos.x-other.x)^2, (pos.y-other.y)^2). So if you haven't meant image edge but an arbitrary edge in the image then you have to compute the edges first (e.g. by Canny()) and find it's nearest distance by comparing each distance of the point to the edge-points. Hope it is clear enough.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-24 05:58:38 -0600

Seen: 565 times

Last updated: Jun 24 '13