Inputs with drawn shapes - Do I need to use a neural network?

I want that in my game when pressing a key, you can draw something by holding the mouse click, and that the drawn figure is an input, for example:

draws circle, DrawInput=circle;

draws square, DrawInput=square;

To recognize what I draw do I need a neural network? Is there a way to train it and use it?

No, neural networks are overkill. We have other algorithms. Like k-means clustering.

OpenCV has a shape recognition feature, but the hard part is getting that into Godot.

You could potentially track the mouse and do some sort of heuristic check. Like find the max length and width and calculate an area within the points.

If area ~= l•w = square
If area ~= (l•w) / 2= triangle
If area ~= π(l/2)² = circle

Here are some other algorithms.

1 Like