MATLAB Answers

0

How to find the nearest pixel to the point attained by ginput() on the curve

Asked by Wu Tong Wu on 13 Feb 2019
Latest activity Answered by John D'Errico
on 13 Feb 2019
The problem is that there is a figure with a curve on it. I want use ginput() to get one pixel on the curve and ask the program to automatically find the nearest pixel on the curve, so that I can identify the curve. How can I do that?

  0 Comments

Sign in to comment.

1 Answer

Answer by John D'Errico
on 13 Feb 2019

Simple is to just extract the curve in terms of pixel coordinates. So you will have a list of points along the curve.
Then use my utility distance2curve, for free download from the file exchange. It computes the closest point on the curve, allowing you to specify various methods for interpolation along that curve, thus a linear interpolation, or more smoothly, various types of splines.

  0 Comments

Sign in to comment.