MATLAB Answers

Recreating the curve from image graph as a matlab plot

29 views (last 30 days)
Suchithra Ramachandran
Suchithra Ramachandran on 22 Sep 2021 at 1:49
Commented: Image Analyst on 5 Oct 2021 at 15:12
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!

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 22 Sep 2021 at 17:45
"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-');

Community Treasure Hunt

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

Start Hunting!

Translated by