It is known that EdgeDetect can find image edges in an image. Suppose the image edges consists of sets of lines. Can the detected edge line near the mouse pointer be highlighted as spline/bezier when mouse moves over, so that i can change the bezier shape by drag the mouse?
(manually highlighting is time-consuming and not accurate, so I want to automatically highlight some part of the edges first, then I can manually change it.)
Update 2014/10/15:
bobthechemist's answer solve part of the question for contour image. Can that be possible when mouse click some position of the grayscale image or true color image?
Here is my code learning from bobthechemist, but it doesn't work. why?
i = ExampleData[{"TestImage", "Lena"}];
ia = ImageData[i, Interleaving -> False][[2]];
im = EdgeDetect[i, 5];
imm = MorphologicalComponents[im];
{n, m} = Dimensions@imm;
trans[{x_, y_}] := {Max[1, Min[n, Floor[n - y] + 1]], Max[1, Min[m, Floor@x + 1]]};
DynamicModule[{ncurve},
EventHandler[
ImageCompose[Image[ia], Graphics[ListLinePlot[ncurve]]],
{"MouseClicked" :>
(ncurve = Position[imm, imm[[##]] & @@ trans@(MousePosition[] /. None -> {0, 0})])}]]
There must be some grammar issue for the last line as it raised two error information:
Union::normal: Nonatomic expression expected at position 1 in Union[ncurve$3420].
ListLinePlot::lpn: ncurve$3420 is not a list of numbers or pairs of numbers.
The result is expected that when mouse click at the grayscale image, the corresponding edge found by MorphologicalComponents at the position should be highlighted or plotted.