Recreating the curve from image graph as a matlab plot

I have an .jpeg image of a graph. I have extracted the x,y coordinates of the black curve usng pixel intensity and would like to recreate the original graph as a matlab plot to extract data. I am not using any digitizer prebuilt functions because I dont want to manually click on the points in the curve to extract data. So my idea is to plot the x,y cooridnates of the black pixel graph as a plot with the origin x and y axis scale and get the data from it. Now I need help to understand how I can plot the x,y coordinates extracted from image to recreate the curve exactly as below? Any better ideas are also appreciated. Thank you!

3 Comments

If you have extracted the points based on image segmentation, then you'll have to contend with the fact that the points are not ordered. Similarly, you'd want to deal with the ambiguity caused by artifacts and the fact that the line is thick. This is one example, and contains links to other similar examples.
I don't have much trust in the accuracy of doing it this way, especially with the retention of small details and narrow peaks where the line thickness will cause problems with edge thinning.
Thank you, I appreciate the information!
But did my code (scroll down) work for you?

Sign in to comment.

Answers (1)

"I have extracted the x,y coordinates " So just sort by x and plot
% Scale
x = rescale(x, time1, time2);
y = rescale(y, 14.4, 23.4);
% Sort in order of increasing x.
[sortedX, sortOtder] = sort(x, 'ascend');
sortedY = y(sortOrder);
plot(sortedX, sortedY, 'b-');

Commented:

on 5 Oct 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!