Given a set of lines, is there a way to train to extract geometric shapes. For example, the picture on left has some blue lines (with red endpoints). How can I train to extract shapes like on the right side? The output must be different shapes with each having a set of points.

I searched for related research papers. I could not find any paper with this exact problem, though some of them came close to this with RNN.

enter image description here


I haven't attempted this, but I'm pretty sure it would work reasonably well.

  1. Identify all points that are connected to more than two lines. We know these must be vertex points.
  2. For for all the points that are attached to only one line, identify their nearest neighbor and draw a line between them (this would connect that hole on the right wall of your house). All points should now be either labeled as a vertex or touching only two lines.
  3. For each point touching two lines, calculate the angle between the two lines.
  4. Find the min and max of these angles.
  5. Use these as prototypes to classify angles into two proximity clusters using agglomerative clustering. Alternatively, pick a fixed angle value as your threshold (maybe around 120 degrees) and use that as the decision boundary for this classification.
  6. The angles that clustered with the min correspond to the missing vertices.
  7. Infer the vertex-vertex connectivity graph through the non-vertex points.(i.e. find all paths between pairs of vertices that do not pass through a third vertex).
  8. Draw the graph.
  9. Find the cycle's in the graph and color each one separately.

Everything doesn't have to be a big fancy neural network :)


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.