Extract sinusoid from image

Viewed 49

I have this image:

enter image description here

The interface between the gray area in the bottom part and the noisy part in the middle form a somewhat sinusoidal curve. My problem is how do I extract a vector of the same length as the width of the image describing the sinusoidal curve.

So far I have tried xcorr each column of the image to the next column and use cumsum to construct a curve but I havent been successful yet.

Any other ideas?

1 Answers

I don't know Matlab, but this might give you an idea and must be pretty easy to translate - just done in the Terminal with ImageMagick:

magick sinusoid.png -fill magenta -fuzz 5% -opaque "gray(128)" -fill yellow +opaque magenta result.png

enter image description here

That says... "Fill with magenta anything within 5% of mid-grey (128) and then fill with yellow anything that is not magenta."

Of course you might do some morphological closing of holes and edge detection as well. Or scan upwards from the bottom of each column till you encounter yellow.

Related