How to find the nearest pixel to the point attained by ginput() on the curve
1 view (last 30 days)
Show older comments
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
Answers (1)
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
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!