Question

I am using OpenCV for square detection in an image. The squares.c example is a really great help, but my problem is that it recognizes pretty much everything that has 4 corners that are close to 90 degrees.

My goal is it however to only recognize the real squares in an image from a video feed. This means the objects themselves have 4 edges with the same length and 4, 90 degree angles. This sounds rather easy at first, but since an object might be tilted in the image, the angles can vary between something like 45 and 135 degrees and the edges have a different length. If I check these attributes though I am still recognizing rectangles that are no squares.

I've been thinking for a good solution to only recognize real squares for a few days now, but everything I come up with is still flawed. I wonder if any of you knows what the exact relation between the angles of the corners and the edge length is. With my guessing so far I have come pretty far, but sometimes random squares pop up that I don't want to recognize. I really think there is some mathematical relation, but I can't really find a formula for squares in a perspective view.

Any help would really be appreciated!

Was it helpful?

Solution

Without any reference coordinate system, how is this even possible? If you are doing the recognition based on a video feed, can your be "taught" what a square looks like by keeping a square in the field of view at all times? Maybe then you can use this to figure out what the rotations are in 3 space, which you'd then have to apply to everything else in the feed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top