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?
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.