Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Short lines create longer lines- algorithm

Hello experts!


I have a set of short (2D) lines (described by their border points).

1. Some of these lines visually create longer lines (please have a look at the image)

2. These longer lines create geometrical figures


Question:

Can you think about any smart algorithm to detect lines created by short lines and then to detect geometrical figures?


Thank you

panJames




 lines lines
0
panJames
Asked:
panJames
2 Solutions
 
d-glitchCommented:
Sure.  Starting is easy, but making it smart may be hard.

All of your short line segments are characterized by a pair of endpoints and a slope.

You can combine short line segments into longer line segments if the slopes match
to some TBD tolerance and one endpoint of each segment are close enough.
That's another TBD.

Once you 're done with the line segments, you can start looking for corners, and
then polygons.  Look for endpoints that are close enough.

Polygon extraction is one of the standard image processing algorithms.
0
 
t-maxCommented:
This is a hard problem and can't be easily solved. It's similar to make a program to solve captchas.
Moreover, the draw you attached is a 2D but seems to be in perspective, which makes things even harder (a square is a trapezoid, a circle turns to ellipse, etc).
If your problem isn't constrained by some pre-defined assumptions, I'm not sure you'll find an algorithm to solve this, no matter how "smart" it is.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now