Ask Your Question

Find polygon in image (rotation-invariant)

asked 2013-02-12 12:13:08 -0500

melongex gravatar image


So in an application I'm writing I have to detect polygons in a scene. The polygons are the contours of some objects (I simply illuminate my objects using a backlight), such that the object is black and the background is grey.

There's always only one object present in each image at a time and I know what polygon I should look for (All points of the polygon and therefore its edges are given)

What I don't know is firstly the location of the object in the image (e.g. its contour) and the rotation of the object.

Is there any way to detect this with opencv. What I tried so far is using some of the FeatureDetectors. The do not seem to work properly with my grayscale images since they don't detect so much interesting features, probably because my images are almost binary.

I'd love to simply use a canny filter on the image to get all the edges and match those with my polygon, but I don't really know how to do this.

Do you have any suggestions?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-02-13 02:24:09 -0500

updated 2013-02-16 02:22:33 -0500

The function findcontours is doing all for you: it finds the contours in an images. If your image is binary, it will be easy. After, just iterate through the contour to be sure it's the right polygon.

edit flag offensive delete link more


Thanks for your suggestion, however I don't really know how to get The Polygons rotation etc. with findContours. Can I use my contour points as keypoints for SURF an The match these with my polygon?

melongex gravatar imagemelongex ( 2013-02-14 03:41:51 -0500 )edit

Question Tools


Asked: 2013-02-12 12:13:08 -0500

Seen: 1,057 times

Last updated: Feb 16 '13