Datasheets often contain useful data in the form of a graph. Unfortunately, since the graph is just an image its usefullness is limited to what one can discern by eyeballing alone. Luckily, it’s easy to convert a graph like this to a point series one can perform calculations with. To demonstrate this we will use the “Photodiode Spectral Responsivity” graph found in the datasheet for the TAOS TSL230R programmable light to frequency converter.
First zoom in on the pdf so that the graph fills the screen. Now use the Print Screen button on your keyboard to capture an image of the graph. Next open the captured image in a image editor and crop it so only the graph shows.
This graph can now be turned into a point series with GNU Octave or MATLAB by tracing the graph with mouse clicks and recording them with ginput; you should click more around areas of the curve that show greater change. When you’ve finished tracing the graph, the resulting points will be in the image’s coordinate system and must be transformed to the graph’s coordinate system using polyfit and polyval. Finally, a fine-grained point series with uniform spacing can be achieved by using interp1.
I = double(imread('graph_image.jpg')); %load the image
imagesc(I) %display the image
[x, y] = ginput; %trace the graph with mouse clicks
[xt, ign] = ginput; %click the major ticks along the x axis
px = polyfit(xt, [300 400 500 600 700 800 900 1000 1100].', 1);
w = polyval(px, x); %convert from image domain to graph domain
[ign, yt] = ginput; %click the major ticks along the y axis
py = polyfit(yt, [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2].', 1);
S = polyval(py, y); %convert from image range to graph range
lambda = [300:0.1:1100]; %fine-grained uniformly space domain
Si = interp1(w, S, lambda, 'linear')



Thank you for this snippet, a real time saver
Works even better with log log graphs as they are even harder to read accurately..
Method very much appreciated. Thank you for posting this.