How to transfer graph data into MATLAB using image processing?

Réponses (2)

Asad Mirza
Asad Mirza le 25 Fév 2019
What you need is is either GRABIT or WebPlotDigitizer.

5 commentaires

I am doing my research, might not be allow to use others' completed GUI. Can you suggest some MATLAB image processing code or solution to extract the data?
For example changing it to binary image. Thanks. I would like to anaylse the graph with the data extracted.
Asad Mirza
Asad Mirza le 25 Fév 2019
Modifié(e) : Asad Mirza le 25 Fév 2019
I believe the GRABIT link has all the code for the GUI so you could investigate it and see how it does the image processing and then reverse engineer it for your own code?
As far as an algorithim to get the graph on your own here is an idea.
  1. Denoise the image using a median filter or something similar.
  2. Find the ROI of the graph from the entire image, easier to work on a smaller area.
  3. Binarize the image with imbinarize
  4. Since you are lucky your graph has little skew so you could figure out all the vertical and horizontal black in the ROI and set them to white.
  5. Ideally whatever is left over should just be the data and the background. You could use find() on the image and get the xy positions of all the black data points.
There are a number of File Exchange Contributions with tag:digitize that approach the problem in various ways.
Hi, can suggest a solution to filter the vertical and horizontal line?
Asad Mirza
Asad Mirza le 26 Fév 2019
Modifié(e) : Asad Mirza le 26 Fév 2019
Easiest way is find the gradient of the image and then set a threshold value to what counts as a verticle line. But it's a quick and dirty way and prone to errors.
im=imread('image.jpeg');
im=rgb2gray(im);
[gx gy]=imgradientxy(im);
Verts=gx>800; %% gx for verticle lines or gy for horizontal lines
imshow(Verts);

Connectez-vous pour commenter.

If it were me, and it was just this one picture (not hundreds of pictures), I'd
  1. bring it into Photoshop
  2. Crop the image to the bounding box
  3. Resize the image to 2100 pixels high.
  4. Enlarge the canvass to 2400 pixels by extending out the bottom
  5. Paint white over all the non-signal parts using the paintbrush tool(this is the only time-consuming part)
  6. Save it out as a PNG image
  7. Bring the image into MATLAB and scan the image column by column looking for the last black pixel
I'm attaching a rough estimate of what I get through Step 6. Of course this is a very very low resolution image so it's very difficult to determine what is signal and what is grid or numbers. It's essentially a judgment call so that's why I chose to do pre-processing manually in Photoshop.
For Step 7:
for col = 1 : columns
rowOfSignal(col) = find(grayImage(:, col) < 128, 1, 'last');
end
% Convert to range 300 - 2400
signalValue = 2400 - rowOfSignal;

Catégories

En savoir plus sur Images dans Centre d'aide et File Exchange

Question posée :

Sam
le 25 Fév 2019

Community Treasure Hunt

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

Start Hunting!

Translated by