Ask Your Question

Revision history [back]

Image of Graph to data: how to extract data from a curve on an image of a graph?

I am trying to write some software that at least partially automates the process of extracting data from an image of a graph. As an initial sample image I am using this graph:

image description image description

I have managed to use the threshold operation and findContours to collect all the lines in the graph as a single contour.

I now want to think about separating out the different lines. Given the graph is oriented exactly vertical it should be easy to separate out gridlines from the curve.

What I am concerned about is finding a way to make sure that the curve (and in subsequent cases each curve) is stored as one vector of Points.

Once I have written the software to do that it should be quite straightforward to do any logarithmic scaling and and text recognition (using libtesseract) to extract floating point data points for the curve.

So, are there any established ways for looking at the long term change in orientation between segments of a contour to seperate it out into individual lines and curves?