I have this project were I need Python to detect simple geometric shapes inside an image. Only using Pillow, for example:
After searching the internet, I still don't know how to achieve this. Thanks in advance for any help
Use the findContours() and approxPolyDP() Functions of OpenCV to Detect Shapes Present in an Image. We can find shapes present in an image using the findContours() and approxPolyDP() function of OpenCV. We can detect shapes depending on the number of corners it has.
Pillow provides a drawing module called ImageDraw that you can use to create simple 2D graphics on your Image objects.
Get edges first.
Magnitude = sqrt(dx2+dy2)
Threshold and convert to 0,1
magnitude image. Follow lines and look for corners, following perimeters of shapes.
Or write more complex corner detection algorithms as found in OpenCV
.
Shape is based in number of corners found. (Looks like GTKbai
!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With