Find the distance of a point from a line in an image.

1 次查看(过去 30 天)
Hi
I'd like to request some help. I have an noisy image with its edges detected using Sobel. I need to take each line(edge) on the image and find the distance of all points on the image(edge detected image) from those lines. The trouble I am having, is figuring out how to find the distance of points from a line. How do I identify the line? Is there any function to find the equations of a line in an image?

回答(1 个)

Roger Stafford
Roger Stafford 2017-11-2
If A and B are coordinate vectors of two points on your line, and C is the vector of another point, the orthogonal distance of point C from the line AB is:
BA = B-A;
CA = C-A;
norm(CA-dot(CA,BA)/dot(BA,BA)*BA);

产品

Community Treasure Hunt

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

Start Hunting!

Translated by