Find Octagon in image?

Hello,

I have an Cam m7 here and want to know if it’s possible to detect octagons in an image?
I know I can find circles and rectangels.

Thanks a lot.

Not really, just consider an octagon a type of circle. If you need to differentiate between a circle and an octagon that’s very hard.

Okay, then I will differentiate between circles and octagons one step later.
What about triangles. Important: I don’t want to use colors (find_blobs) for this task.

Find lines would be the thing to use for this.

For any of these shapes, you can inspect the intersections and make a decision.

In general, this is not easy, even with OpenCV it involves some type of algorithm that has to work on the detected line segments of a shape and then determine what that shape is based on that.

Hi, It’s actually possible to make find_rectangles() detect any number of points on an object. I.e. it can detect triangles, octagons, etc. I’ll add a find_shape() method that will return all shapes with some number of points in the future. Since it will use the find_rects() code base it will be able to handle curves lines and skew in the object.

That would be awesome. Could you give me a hint on how to alter find_rects(), because it only accepts two arguments (roi and threshold)?
Thanks a lot

Um, this requires a lot of C code changes in some very complex code. I note quite sure how to actually do it myself. But, when reading the AprilTag code which is what the quad finder comes from I realize it can be turned to find any shapes with some number of points.