I have the following oscilloscope image:
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.
Answer
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
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
If you understand this, then you can extract the width and height of the grid, and scale the points accordingly.
Comments
Post a Comment