0

I'd like to classify simple shapes (see the attached "sample resource of shapes") algorithmically (automatically). Does anyone know how to do that?

The intended result would be a text such as "line", "circle", and "triangular" etc.

sample resource of shapes

Yuta
  • 11
  • 1
  • I would make a list of "simple shapes" and start writing a detector for each. – MrSmith42 Apr 28 '22 at 07:17
  • Please keep the questions concise and to the point. As [tour] says, "This site is all about getting answers. It's not a discussion forum. There's no chit-chat." We do not need Beatles to know you needed help. – Amadan Apr 28 '22 at 07:22
  • This [Turi Create sample](https://apple.github.io/turicreate/docs/userguide/drawing_classifier/) might be of interest. – Amadan Apr 28 '22 at 07:34
  • How many shapes like this do you have? Can you classify some of them by hand, in order to use a supervised learning algorithm? – Stef Apr 28 '22 at 08:18
  • 1
    Do all possible inputs consist of (possibly broken) thin lines? Should several lines near each other or parallel to each other be interpreted as separate (e.g. long ellipse is circle-like) or combined into one line? Then as a first step the line(s) should be traced and vectorized. In a second step that representation can either be classified by a) rules/heuristics, e.g. topological rules b) redrawn in a better way (e.g. with closed gaps) and filtered by algorithms (e.g. fill algorithm) c) dealt with a probabilistic method (e.g. neural network) – Sebastian Apr 28 '22 at 12:08

1 Answers1

1

Make sure that the shapes are always aligned the same way (for instance bottom-right justified) and decompose the space with a grid (say 6x6). In each grid cell, determine the length of the stroke that traverses it, and possibly a dominant direction.

For recognition, perform the same decomposition of the shape and try a matching with all templates. You need to define a distance function that is minimized when the lengths and directions are identical and smoothly decreases otherwise.