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

1 Ansicht (letzte 30 Tage)
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?

Antworten (1)

John D'Errico
John D'Errico am 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.

Community Treasure Hunt

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

Start Hunting!

Translated by