No BSD License  

Highlights from
Extracts data points as a vector from a scanned plot (*.tif)

from Extracts data points as a vector from a scanned plot (*.tif) by Balajee Ananthasayanam
Extracts data points as a vector from a scanned plot (*.tif).

extract_plot_data(filename,a,b,fa,fb)
function [x,y] = extract_plot_data(filename,a,b,fa,fb)
% 
% This function extracts data from plots that are scanned
% and saved as a tif file.
%
% filename - 'filename.tif'
% a - bottom left x coordinate.
% b - top right x coordinate.
% fa - bottom left y coordinate.
% fb - top right y coordinate.

%    [x,y] = extract_plot_data('normal.tif',a,b,fa,fb)

% comments to:
% Balajee Ananthasayanam - bananth@clemson.edu
% 01/03/2005
%
% Thanks to Hariprasad Kannan and James Gibert

format short

[A] = imread(filename);

scrsz = get(0,'ScreenSize');
figure('Position',[scrsz(1) scrsz(2) scrsz(3) scrsz(4)]);

imagesc(A);

%   Setting the scales from plot.
title(['\bf Pick bottom left corner and then top right corner of the plot']);
[xmin_xmax, ymin_ymax]= ginput(2);
am = xmin_xmax(1);
bm = xmin_xmax(2);
fam = ymin_ymax(1);
fbm = ymin_ymax(2);

A = (a - b)/(am-bm);

B = (b*am - a*bm)/(am-bm);

fA = (fa - fb)/(fam - fbm);

fB = (fb*fam - fa*fbm)/(fam - fbm);

title(['\bf Trace Plot, press enter when done'])

[xm, ym]= ginput;

x = A*xm + B;

y = fA*ym + fB;

Contact us at files@mathworks.com