I started with the image you provide and called it `img`

. This solution isn't perfect but it might serve as a starting point.

**Get some known points:**

I right clicked the image and selected "Get Coordinates". I then clicked as closely as possible to the origin, and the points {0,1.3} and {10.,.82}. On Windows hold Ctrl+C to copy those points. And then Ctrl+V to paste them into the notebook...

```
{o, y, x} = {{36.5173`, 206.72`}, {17.5824`, 17.3711`}, {391.209`, 54.9028`}};
```

**Find a transformation that will return the proper points:**

Here I use `FindGeometricTransform`

and feed it the known values for the selected points along with their image coordinates. This produces a `TransformationFunction`

to use later.

```
trans = FindGeometricTransform[
{{0, .82}, {0, 1.3}, {10, .82}},
{o, y, x}
][[2]];
```

**Obtain and process the image data:**

Here I round the RGB color values in the `ImageData`

so that the blue curve is coded as {0,0,1}. This will allow me to extract the curve.

```
data = Round[ImageData[img], 1];
col = DeleteDuplicates[Flatten[Round[ImageData[img], 1], 1]];
Graphics[{RGBColor[#], Disk[]}, ImageSize -> Tiny] & /@ col
```

The nice blue color I'm wanting to extract is the third color in the list. Now I binarize the image. I convert non-blue pixels to black and the blue to white.

```
binImage = Image@Replace[data, {col[[3]] -> 1, _ :> 0}, {2}]
```

But this has some spurious points I'd like to remove so I only have the curve remaining. I'll use a `GaussianFilter`

to create a binary mask that will allow me to filter those points out. This should give me the curve I want.

```
curve = ImageApply[{0, 0, 0} &, binImage,
Masking -> ColorNegate[Binarize[GaussianFilter[binImage, 5]]]]
```

That's much cleaner! Now to extract the locations of the white pixels while maintaining the proper orientation.

```
curvLoc = (Reverse /@
Position[ImageData[curve, DataReversed -> True], {1., 1., 1.}]);
```

Apply the transformation before to the curve points and show it with the original plot before distortion. I called this `plot`

...

```
Show[ListPlot[trans@curvLoc, PlotRange -> All], plot]
```

Its not perfect, but it should be a start.

**EDIT:** I realized that the coordinates of the origin were actually {0,.82} rather than {0,.8}. With this realization we get an even better approximation. Note that I've also employed an interpolating function. Using various smoothing techniques on the function values prior to interpolating should further improve things.

```
pts = Sort[trans@curvLoc];
g = Interpolation[pts, InterpolationOrder -> 1]
Show[Plot[g[x], {x, .05, 10}, PlotStyle->Red], plot]
```

Wait, you want to sample points from a printed

curve? – J. M.'s ennui – 2012-02-08T23:43:26.2231Exactly. I would like to be able to re-generate the plot in Mathematica with reasonable precision, for example to compare my data with the results pictured in a paper. – David – 2012-02-08T23:46:46.547

As a start: you could use

`FindGeometricTransform[]`

to try to find the transformation matrix you can use as the second argument of`ImagePerspectiveTransformation[]`

; this is assuming that the distorted version has axes that you know to be actually orthogonal. – J. M.'s ennui – 2012-02-08T23:47:15.5477

I believe this tool does what you want: http://getdata-graph-digitizer.com/index.php ; nevertheless it's not free, and since you already have a Mathematica license, and this is a Mathematica site...

– P. Fonseca – 2012-02-09T00:17:19.8433@P.Fonseca It's Windows only. Bad idea for a research tool ;( – David – 2012-02-09T00:38:30.050

Many years ago I remember doing this using a product called digiMatic for Mac OS 7. It is long gone. – Gustavo Delfino – 2012-02-09T04:17:40.090

1

@David There are lots of programs like that. The last one I used was Java based: http://plotdigitizer.sourceforge.net/ When I have the original PDF of the article, I cut the figure with an illustration program, remove unnecessary things such as axes, and import the curve into Mathematica as vector format. When I do this in practice I tend to decide based on which one is the minimal effort method..

– Szabolcs – 2012-02-10T18:34:40.250I think you could try PlotDigitizer. It can extract data from various graphs, including XY. It also has a free online app.

– Anonymous – 2021-01-15T10:41:03.840Related: http://dsp.stackexchange.com/a/1061/581

– Szabolcs – 2012-02-28T18:10:40.660