I am putting together a program to calculate some stuff with oscilloscope outputs, but as the program works now, I just import the image into MATLAB and then use ginput to find the coordinates of various regions on the generated curve.
Is there a way that I can take, say, this image:
and have ginput or something similar automatically trace along the bright green curve and store the x,y coordinates to separate arrays (perhaps by being able to discriminate between the color of the curve and the background color)? That way I can instead use an actual plot of the x,y coordinates of the curve in the picture, instead of needing to actually use the image in the data analysis.
The closest I've been able to get is just using [x,y]=ginput
to mash the mouse button along the curve and generate a massive array, but my fingers need rest!
Thanks!
Take a look at this
Now you can plot the points:
Resulting with
If you are troubled by the fact that the line is thick (i.e., multiple y values for each x) you can simply take the mean
Visualizing the line
If you are after the grid as well, then
To determine the grid points we seek
x
such that many grid pointsgy
has the samegx
Same for y:
Remove duplicates:
Create the grid points
Now the whole picture: