Está en la página 1de 4

11/29/13

How to Convert a Graph Saved as an Image to Point Series Plot Data | Jonathan Thomson's web journal

JONATHAN THOMSON'S WEB JOURNAL

How To Convert A Graph Saved As An Image To Point Series Plot Data April 24, 2010
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, its 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.

jethomson.wordpress.com/tsl230r-articles/how-to-convert-a-graph-saved-as-an-image-to-point-series-plot-data/

1/4

11/29/13

How to Convert a Graph Saved as an Image to Point Series Plot Data | Jonathan Thomson's web journal

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.

jethomson.wordpress.com/tsl230r-articles/how-to-convert-a-graph-saved-as-an-image-to-point-series-plot-data/

2/4

11/29/13

How to Convert a Graph Saved as an Image to Point Series Plot Data | Jonathan Thomson's web journal

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 g i n p u t ; you should click more around areas of the curve that show greater change. When youve finished tracing the graph, the resulting points will be in the images coordinate system and must be transformed to the graphs coordinate system using p o l y f i t and p o l y v a l . Finally, a fine-grained point series with uniform spacing can be achieved by using i n t e r p 1 . I=d o u b l e ( i m r e a d ( ' g r a p h _ i m a g e . j p g ' ) ) ;% l o a dt h ei m a g e i m a g e s c ( I )% d i s p l a yt h ei m a g e [ x ,y ]=g i n p u t ;% t r a c et h eg r a p hw i t hm o u s ec l i c k s [ x t ,i g n ]=g i n p u t ;% c l i c kt h em a j o rt i c k sa l o n gt h exa x i s p x=p o l y f i t ( x t ,[ 3 0 04 0 05 0 06 0 07 0 08 0 09 0 01 0 0 01 1 0 0 ] . ' ,1 ) ; w=p o l y v a l ( p x ,x ) ;% c o n v e r tf r o mi m a g ed o m a i nt og r a p hd o m a i n [ i g n ,y t ]=g i n p u t ;% c l i c kt h em a j o rt i c k sa l o n gt h eya x i s p y=p o l y f i t ( y t ,[ 00 . 10 . 20 . 30 . 40 . 50 . 60 . 70 . 80 . 91 . 01 . 11 . 2 ] . ' ,1 ) ; S=p o l y v a l ( p y ,y ) ;% c o n v e r tf r o mi m a g er a n g et og r a p hr a n g e l a m b d a=[ 3 0 0 : 0 . 1 : 1 1 0 0 ] ;% f i n e g r a i n e du n i f o r m l ys p a c ed o m a i n S i=i n t e r p 1 ( w ,S ,l a m b d a ,' l i n e a r ' )
jethomson.wordpress.com/tsl230r-articles/how-to-convert-a-graph-saved-as-an-image-to-point-series-plot-data/ 3/4

11/29/13

How to Convert a Graph Saved as an Image to Point Series Plot Data | Jonathan Thomson's web journal

Comments (2)

2 Responses to How to Convert a Graph Saved as an Image to Point Series Plot Data
1. Guillaume Simard Says: July 16, 2010 at 1:51 pm Thank you for this snippet, a real time saver Wo

jethomson.wordpress.com/tsl230r-articles/how-to-convert-a-graph-saved-as-an-image-to-point-series-plot-data/

4/4

También podría gustarte