File Exchange

image thumbnail

Grab 2D points

version 1.0 (857 KB) by

This code is used to digitize 2d figures that you find in publications, journals, or simply scanned



View License

% This code is used to digitize figures that you find in publications, journals, or simply scanned reports or documents by clicking on the desired points using the mouse.
% You can use it to pick [x,y] points by clicking on the original scanned plot.
% To run, simply type:


% and then follow the instructions
% Notes:
% 1- Plots or figures should be of jpg, png, bmp or any other format that is
% acceptable by matlab and in the same directory as these m-files you are using.
% 2- You don't have to select the points in increasing or decreasing
% order. Click wherever you want on the plot. I have written a small code
% to sort the vectors in ascending order
% 3- The [x,y] data points will be saved in GRABBED.mat. Load
% GRABBED.mat and the first column of GRABBED will be your absisca points, the second
% are the ordinates.

% This code is written by
% Nassim Khaled
% June 2007

Important:Change imshow to imagesc for people without Image Processing Toolbox.

Comments and Ratings (5)

Very helpful indeed. My problem is that the y axis of the picture/figure that I am trying to get data from is a log scale. How would you suggest I manipulate the data to show that the scale is in fact a log scale and not a linear one which this script assumes? I can clarify further is the question is not clear.

Thanks, really appreciate it!


This worked fairly well, but I would suggest suppressing all of the save commands. It makes it fill up any folder that you run it in with x_min.mat, x_max.mat...etc. Also, I would suggest prompting for the user for the name to save the data. The following works well:

[FileName,PathName,FilterIndex] = uiputfile('*.mat','Save File As');
save(FileName, 'X', 'Y')

Also, can this accomidate a skewed image, for example in an old school scanned image, the angle between the axis might not equal 90 degrees.

Martin Hansson

Suggestions for improvements:
- Change imshow to imagesc to make available for people without Image Processing Toolbox.

- The matlab axis should be changed to the one in the scanned picture after given this input.

- Include log axis

- Include the possibility of rotated image (see digitization by Harald E. Krogstad)

- Don't close the "working" window

Mohannad Hakeem

Saad Maakaron

Comes in handy when needed.


I have made use of one of the comments to modify the submission.

I made an update on one of the m-files.

I have to include some .*fig files that were missing.

MATLAB Release
MATLAB 7.0.1 (R14SP1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video