1
$\begingroup$

I'm trying to break a continuous line segment into multiple, straight segments. Group of line segments as connected

I've tried using the Hough transform but have found it unreliable for getting the line segments I'm looking for and because it demands too much fine tuning to fit the automated medium I'm working in.

Analyzing points (comparing slopes/averages) as they change has shown some success, but the lines found are often too segmented or too unsegmented (just the whole line), proving unreliable so far. These are also prone to give too much of the subsequent line before cutting off when they have worked.

Contextual restrictions include:

  1. Only one 'Y' value per X point (this image doesn't show this, but the property holds).
  2. There are no gaps between points in the line.
  3. Noise is possible, but not that bad usually (within a few pixels of being correct).
  4. The lines being detected are straight, not curved.
  5. This is being developed in C++ using the SDL2 framework.

I feel like I'm overcomplicating this question. How can I find the points that separate the segments? I suspect something comparing averages or averages of averages might be the way to go.

$\endgroup$
  • $\begingroup$ Can you show what you've tried so far, what the results were, and what you were expecting? Would the above image be three or four lines, for example? (Or something else?) $\endgroup$ – user1118321 Jul 6 '17 at 4:05
  • $\begingroup$ Points 1 and 2 together imply that no line will have a slope greater than 45 degrees above or below horizontal. Is this correct or do the definitions need to be adjusted? $\endgroup$ – trichoplax Jul 6 '17 at 9:02
  • $\begingroup$ What kind of noise does point 3 refer to? Does this only add points, or can points be removed/moved (which would then sometimes leave gaps between points in the line)? $\endgroup$ – trichoplax Jul 6 '17 at 9:03
  • $\begingroup$ We won't know for certain until you have fully specified what you are looking for, but it sounds likely that this is a far from trivial task, rather than you overcomplicating it. $\endgroup$ – trichoplax Jul 6 '17 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.