Perpendicular distance between points on line

7 ビュー (過去 30 日間)
Benedikt Kniebel
Benedikt Kniebel 2019 年 5 月 25 日
コメント済み: Rik 2019 年 5 月 26 日
Hello,
I started with image processing a couple of days ago.
My problem: I want to measure the shortest distance between each point of the inner red line (via bwboundaries ) and the outer green line.
The blue (distance)vectors should be perpendicular to the inner line wich makes my problem even worse (especially in case in the lower part of the image)...
Right now I have all points of the inner and outer line but have no clue what to do.
Thanks for your help!pic1.JPG
  1 件のコメント
Rik
Rik 2019 年 5 月 26 日
If it has to be perpendicular, you only need to find out which of 4 directions you need to check, and then find the green point that satisfies that.
For the end point pixels you need to decide based on your application what would make sense.

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2019 年 5 月 26 日
編集済み: KSSV 2019 年 5 月 26 日
YOu can use knnsearch. This will give you closed point in green curve to each point in red curve, as the it is the closest point, it will be (close to) perpendicular.
Or, you may use pdist2. Read about it.
Or, follow the coordinate geometry way: you have the point and know slope, find the required striaght line and get intersection. To get intersection use: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

Community Treasure Hunt

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

Start Hunting!

Translated by