Tracing line in a graph

6 views (last 30 days)
Ilham Hardy
Ilham Hardy on 9 Aug 2015
Commented: Ilham Hardy on 10 Aug 2015
Dear all,
I have question on how to 'trace' a line in a graph. This is my first attempt to do 'image-processing' in Matlab, so pardon me if my explanation is a bit lenghty.
Let me start from the beginning,
  • I have a graph (in paper) that i need to convert to data for further processing.The graph contains several lines (two line groups), each line need to be read (converted to data) as rigorously as possible (so less to none interpolation operation).
  • What i did is scanned the graph, and traced each line group as closely as possible with two colors (blue and green in MS Paint), then i read the file in Matlab (bitmap). By applying some threshold in RGB channel, i get the blue and green line. (no problem here)
  • The green line is a single continous line. The blue lines contain several 'open curves' and also several 'closed curve'. Each line of the blue lines has different label, so i need to further defines the blue line.
  • I am able to trace the 'open curve' blue lines by creating difference mask. If the difference is above certain threshold then it belongs to another line..
  • The question how can i trace the 'closed curve' blue lines? When i implement the same approach for the 'open curve', i only get the bottom half of the curve (logical, because the difference threshold).
  • I tried to trace it with more 'brute'-way, i masked the white-part (background) to NaN and i do while loop in x-axis, find the top and bottom of y-axis for each x-axis (script skip to the next x when several nan encountered). The idea is to loop forward and backward (when the last x is processed, say lower half of the curve is traced, do backward processing for top half until the starting point is reached). However the 'closed line' is not really closed . There are several gaps in the line . When there is gap, the do-while part of the script tend to pick points of other closely located closed-curve line.
To support my explanation, i attach the picture of the graph (blue lines, halfly traced). I don't think i can put the data and the script here though..
PS: I only have Matlab, no additional toolboxes. :)
Thanks, ILham
  2 Comments
Star Strider
Star Strider on 10 Aug 2015
@Ilham — Perhaps if you asked, and if the paper was relatively recent and contact information provided, the authors would provide you with the data for that figure.
Nothing ventured, nothing gained.
Ilham Hardy
Ilham Hardy on 10 Aug 2015
Hi StarStrider,
It is actually something from the manufacturer, and they tend not to give away a detailed information (data) to avoid revealing their real efficiencies to their con-colleagues.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 9 Aug 2015
Do you have to use image analysis? Why not just digitize it manually using something like this: http://www.mathworks.com/matlabcentral/fileexchange/36904-matlab-script-for-digitizing-a-published-graph
  1 Comment
Ilham Hardy
Ilham Hardy on 10 Aug 2015
Dear IA,
That was actually my first attempt to convert (digitize) the graph, by manually selecting several points on top of the lines. However the results (surf) is not as smooth as i required. Ergo the image analysis digitizing option was selected.
I am kind of half-way there though, I only need to figure out how to read the closed-curve lines. :)
Regards, Ilham

Sign in to comment.

Categories

Find more on Just for fun in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!