⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Shape detection - recognition

  • Hello,
    I'm looking for a way to detect basic shapes like circle, triangle etc. that are either as images or as QPainterPath.

    Basically what I want to do is to detect and classify shape that is drawn by user.

    Any suggestion how would I go about this?

  • Hello,
    Thanks for reply.
    Yes I know that OpenCV can detect shapes from images, but what I was looking for is detection base on path.

    Maybe some simply classifier based on shape points angles or other techniques (what techniques? - that's the question).

  • Google for the shortstraw algorithm, should find those 2 articles:

    "ShortStraw: A Simple and Effective Corner Finder for Polylines"
    "Revisiting ShortStraw – Improving Corner Finding in Sketch-Based Interfaces"

    It's easy to implement or you might find some implementations around.

    Once you have the corners you can find if the edge between them are roughly straight lines, find the angle between each edge, find the edges that are crossing each other, etc.

    With that information you can classify your shapes. For example, 4 corners, 4 straight lines, about 90 degree angles imply a rectangle or a square.

    I'm planning on using that technique for a project of mine.

  • @sandy.martel

    Thank You for the paper information.
    What You posted is my initial idea of implementing it but I just wanted to ask before, because maybe someone already did lib or something.

    Anyway thanks for the info.

Log in to reply