0

Given an image consisting of black lines (a few pixels wide) on white background, what is a good way to find the coordinates along the the lines, say for every 10th pixel or so? I am considering using PIL for the task, but other python or java-based libraries would also be OK.

Ideally the coordinates would point to the middle of the line, but as the lines are narrow, it's enough that they point somewhere inside the line.

A very short line or a point should be identified with at least one coordinate.

Roar Skullestad
  • 2,427
  • 3
  • 26
  • 35
  • This is an old question and I saw your response about not needing it any more but here is an example which looks for the highest vote only (no thresholding implemented) on an image modelled as an array with binary values https://alyssaq.github.io/2014/understanding-hough-transform/. I've been trying to understand it but get caught up right at the end – Scott Anderson Jan 16 '19 at 23:34

1 Answers1

2

Usually, Hough transformation is used to find lines. It gives you the parameters describing the line (which can be transformed easily between different representations), and you can sample this function to get your sample points. See http://en.wikipedia.org/wiki/Hough_transform and https://stackoverflow.com/questions/tagged/hough-transform+python

I only found this http://coding-experiments.blogspot.co.at/2011/05/ellipse-detection-in-image-by-using.html implementation in python, which actually searches for ellipses.

Community
  • 1
  • 1
Rudolf Mühlbauer
  • 2,511
  • 16
  • 18
  • Thanks! I started to look into this, but premises changed so line detection no longer necessary... But good to know about this for the future! – Roar Skullestad Oct 18 '12 at 10:34