
Re: Converting a magnified image of a line to a single pixel smoothed
Posted:
Apr 20, 2013 5:54 AM


I tried converting the result image to a graph so that I could apply a moving average and then fit a Bspline through it. As you can tell I'm new to Mathematica: data = ArrayRules@SparseArray@ImageData[result] It was all downhill after that. Another nudge would be appreciated. Thanks, Dave.
Dave,
On 4/17/13 1:30 AM, Dave Waddell wrote: > I have a magnified image of a 0.1mm line here: > http://www.dave.org/images/Trace.jpg > ... this converts with Binarize very well: > http://www.dave.org/images/Trace%20binary.jpg > ... but what I would like to do is convert it to a single pixel wide smoothed line running right up the middle. Any suggestions or pointers on how to do this in Mathematica would be appreciated. > Dave >
The sequence below seems like a good start. The documentation for the functions should help you understand what is going on in more details:
trace = Import["http://www.dave.org/images/Trace.jpg"]
b = ColorNegate@Binarize[trace]; b2 = SelectComponents[b, "Area", 1]; b3 = FillingTransform@b2; dt = ImageAdjust@DistanceTransform@b3; result = ColorNegate@Image[WatershedComponents[dt], "Bit"]; HighlightImage[trace, result]
Matthias Odisio Wolfram Research

