Making sinusoidal curve in image into straight line in output image Matlab : I have to make a sinusoidal curve in image to Output an equal straight line in the resulting image. [an example of input sinusoidal image is here][1].

What i think is one solution should be,

 

Placing down the origin of x and y coordinates at the start of the curve, so we will have y=0 at starting point.

then points on the upper limit will be counted as such that 
y= y-(delta_y)

and for lower limits,
y=y+(delta_y)

 so to make upper points a straight line, our resulting image will be

O[x,y-delta_y]= I[x,y];


but how to calculate deltaY for each y on horizontal x axis(it is showing distance of curve points from horizontal axis)

Another solution could be, to save all information of the curve in a variable and to plot it as a straight line, but how to do it?


  [1]: https://i.stack.imgur.com/kCiTx.jpg