3
$\begingroup$

I have the following oscilloscope image:

enter image description here

I would like to extract the points of the yellow curve together with the correct values. Do you know how I could do it?

Extracting the yellow curve from the background seems quite difficult to me.

$\endgroup$
  • 2
    $\begingroup$ The information for "correct value" can not be derived from the image alone. You will need to know what the grid lines on the scope represent in physical units to scale from pixel coordinates to physical units. $\endgroup$ – m_goldberg Mar 8 '18 at 14:14
  • 3
    $\begingroup$ Dude this is an image from digital oscilloscope, use your hardware properly to get raw data. $\endgroup$ – Vsevolod A. Mar 8 '18 at 17:14
  • 1
    $\begingroup$ There's this answer which should help. $\endgroup$ – bobthechemist Mar 8 '18 at 23:21
  • 1
    $\begingroup$ ... and this answer. Plenty of tools to get the job done. $\endgroup$ – bobthechemist Mar 8 '18 at 23:22
  • 2
    $\begingroup$ @VsevolodA. Maybe the OP has no control on the oscillator. $\endgroup$ – anderstood Mar 9 '18 at 0:14
5
$\begingroup$

Here I trim manually, but you could use Image[MorphologicalComponents[img] and detect the bounding box instead (actually, that's how I found 57 and 455).

img = Import["https://i.stack.imgur.com/NYfVj.png"]
pt1 = {12, 57};
pt2 = {600, 455};
imgCurve = ImageTrim[Image[MorphologicalComponents[img2]], {pt1, pt2}]
imgGrid = ImageTrim[Image[MorphologicalComponents[img]], {pt1, pt2}] - imgCurve

enter image description here

enter image description here

Then it's not difficult to get the points:

data1 = ImageData[Binarize@imgCurve];
points = Reverse /@ Position[data1, 1];
points[[All, 2]] = 520 - points[[All, 2]];
ListPlot@points

enter image description here

If you understand this, then you can extract the width and height of the grid, and scale the points accordingly.

$\endgroup$
  • $\begingroup$ Thanks a lot ! This is very nice!! $\endgroup$ – james Mar 10 '18 at 7:59
3
$\begingroup$

If you are looking for an interactive solution sometimes it is easier and more flexible to use a specialized standalone program for digitizing graph images. Here is a web-based program that is free to use: https://automeris.io/WebPlotDigitizer/ The program is distributed under the GNU Affero General Public License Version 3.

To illustrate, I digitized your oscilloscope graph, with the following procedure:

  1. Edit the image file to remove the crosshair mark at the center of your graph, because this will interfere with the digitizing process
  2. Go to WebPlotDigitizer site and load the image file. You can also import an image URL if you do not need to clean it up.
  3. After you Align the axes, put a Box around the graph area before extraction. For your graph I used Automatic Extraction using Distance=200, Averaging Window, delX=delY=1 Px
  4. After you finish digitizing, go to View Data and download the data as a .CSV file.
  5. Move the downloaded .CSV file to the correct directory for Mathematica to find it (use Directory[] to find your default folder)

Now you can import and use the data file in Mathematica, as follows:

Directory[]
data = Import["Default Dataset.csv", "CSV"];
ListPlot[data]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you very much ! This is a nice website and tool !! $\endgroup$ – james Mar 10 '18 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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