3
$\begingroup$

How do I convert the following image graph into data (if possible into function)?

enter image description here

I checked this answer and found that my problem is grid and plot have same color.

$\endgroup$
4
  • 1
    $\begingroup$ what about: 3831 $\endgroup$
    – Kuba
    Feb 1, 2016 at 7:18
  • $\begingroup$ @Kuba thank you i'll check it out. $\endgroup$
    – S L
    Feb 1, 2016 at 7:19
  • $\begingroup$ Here is a solution that might work for you: mathematica.stackexchange.com/a/167483/55694 $\endgroup$
    – Vixillator
    Mar 8, 2018 at 23:17
  • $\begingroup$ Maybe you should try plotdigitizer. You can eliminate the grid lines by masking the curve. $\endgroup$
    – Anonymous
    Apr 9, 2021 at 12:29

1 Answer 1

9
$\begingroup$

If the problem is only to remove the grid, that's relatively easy. You just remove everything but the grid, then take the difference.

You can use Closing with a rectangular structuring element to remove everything but the horizontal / vertical grid lines, like this:

img = Import["https://i.stack.imgur.com/TkvSR.png"];    
hFilter = Closing[img, BoxMatrix[{10, 0}]];
vFilter = Closing[img, BoxMatrix[{0, 10}]];

then take the pixel-wise min to get the full grid:

grid = ImageApply[Min, {hFilter, vFilter}];

enter image description here

Then simply binarize the difference:

Binarize[ImageDifference[img, grid]]

enter image description here

(From here, you should be able to use code from the answers already linked.)

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.