Find Octagon in image?

General discussion about topics related to OpenMV.
DerBexucher1
Posts: 3
Joined: Sat Apr 07, 2018 2:30 pm

Find Octagon in image?

Postby DerBexucher1 » Sat Apr 07, 2018 2:33 pm

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.
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: Find Octagon in image?

Postby kwagyeman » Sat Apr 07, 2018 3:52 pm

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.
Nyamekye,
DerBexucher1
Posts: 3
Joined: Sat Apr 07, 2018 2:30 pm

Re: Find Octagon in image?

Postby DerBexucher1 » Sat Apr 07, 2018 5:57 pm

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.
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: Find Octagon in image?

Postby kwagyeman » Sat Apr 07, 2018 8:14 pm

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.
Nyamekye,
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: Find Octagon in image?

Postby kwagyeman » Sun Apr 08, 2018 4:21 pm

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.
Nyamekye,
DerBexucher1
Posts: 3
Joined: Sat Apr 07, 2018 2:30 pm

Re: Find Octagon in image?

Postby DerBexucher1 » Mon Apr 09, 2018 10:59 am

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
User avatar
kwagyeman
Posts: 1745
Joined: Sun May 24, 2015 2:10 pm

Re: Find Octagon in image?

Postby kwagyeman » Mon Apr 09, 2018 12:21 pm

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.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest