Skip to content

aikkala/graph-digitization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

graph-digitization

A Matlab function to digitize graphs (only the area defined by positive x-axis and positive y-axis) from images. Tested with Matlab R2017a.

How to use

The function expects one parameter, a path indicating where the image is located. The image should be

  • in a common image format (jpg, png, gif, etc.)
  • oriented such that positive x-axis is the lowest line, and positive y-axis is the leftmost line (as you'd normally view a graph)

How the function works

Shortly, the function

  1. does a Hough transform
  2. finds the longest lines
  3. assumes the line with smallest y-coordinate (of center of mass) is the positive x-axis, and
  4. the line with smallest x-coordinate (and nearly at right angle against positive x-axis) is the positive y-axis
  5. finds the origo (intersection of abovementioned lines)
  6. finds the points inside the square defined by positive x- and y-axes
  7. transforms them from image's coordinate frame into the graph's coordinate frame
  8. does spline interpolation

Example

The input image

alt text

The outputs

alt text

alt text

Notes

The algorithm is not particularly robust: it is based on some heuristics, and is sensitive to parameter tuning.

About

Digitize graphs from images

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages