# I want to get a special curve in a picture

I have a picture,and I want to get a special curve in this picture ,than draw the line in a new picture.inbut I can't do this . Like this:

The picture is this

Anybody have an idea?

-
This can be done with the method I describe in details [here][1] [1]: mathematica.stackexchange.com/questions/44355/… –  Alexei Boulbitch Apr 15 '14 at 9:25
I'd say with this together with the linked post from @AlexeiBoulbitch your question has an answer already –  gpap Apr 15 '14 at 9:39
Thank you my friends –  czp Apr 15 '14 at 13:14

A complete solution that gives essentially the result you want is the following:

image = Import["http://i.stack.imgur.com/coBQa.jpg"];

img = ImageResize[image, 300];(*scale down to speed up calculation*)
ColorReplace[%, White -> Black, 0.05](*"remove" the black text*)
MedianFilter[%, 5](*remove small speckles*)
EdgeDetect[%](*find edges*)
SetAlphaChannel[#, Binarize[#]] &[Colorize[MorphologicalComponents[%],
ColorRules -> {2 -> Red, _ -> Black}]](*Make the right edge red and the rest transparent*)
ImageCompose[img, %](*compose the original image and the red line*)


To get it to work with the full size image you might need to play with the parameters.

Result:

-
+1, I've added the link, I hope you don't mind :) –  Kuba Apr 15 '14 at 10:55
Oh,thank you very much!! –  czp Apr 15 '14 at 13:09

This method is mainly based on the CurvatureFlowFilter function, which can preserve the shape of the area according to the gradient of the graylevel.

img = Import["http://i.stack.imgur.com/coBQa.jpg"] // ColorConvert[#, "Grayscale"] &;


The threshold of the first Binarize can be determined by checking the graylevel of some sample points of the interested area:

imgBi = Binarize[img, {0.38, 0.48}]


CurvatureFlowFilter is used here to smooth imgBi while keeping the edges relatively unchanged (Note: this function is very time-consuming):

imgSeg = CurvatureFlowFilter[imgBi, 10, 5]


MorphologicalBinarize is useful for excluding small irrelevant areas:

imgMorphBi = MorphologicalBinarize[imgSeg, {.4, .99}]


Use any edge extraction method to extract the edges:

imgEdges = GradientFilter[imgMorphBi, 1] // ImageAdjust // Binarize


HighlightImage[img, imgEdges]


-
nice to see use of CurvatureFlowFilter. –  s.s.o Apr 15 '14 at 18:34
@s.s.o Thanks. It's a very good function, just a bit slow :( –  Silvia Apr 16 '14 at 2:40
A nice answer too.Thank you !! –  czp Apr 16 '14 at 8:09
@czp Glad to help :) –  Silvia Apr 16 '14 at 10:59