1 | initial version |
Generic shape recognition is a harder task and probably needs some training. If your shape set is limited (like in your images), it is easier to write a special detection algorithm for every shape.
For example:
- distinguish shapes with a hole (empty circle, triangle) from filled shapes (filled circle, cross)
using findContours()
houghCircles()
on your contours to find out, if it's a circle. If it's not, it's a cross or a triangleYou can also play around with HuMoments()