views:

95

answers:

1

Hey everyone,

So I'm using openCV to do square recognition on this image. I compiled the squares.c file on an image that I took and here are the results:

http://www.learntobe.org/urs/index1.php

The image on the left is the original and on the right is the image that is a result of running the square detection.

The results aren't bad, but I really need this to detect ALL of the squares and I'm really new to this openCV and image processing stuff. Does anyone know of how I can edit the squares.c file to possibly get the detection to be more inclusive so that all of the squares are highlighted?

Thanks a lot ahead of time.

+1  A: 

All the whitish colors are tough to detect. Nothing separates it from the page itself. Try doing some kind of edge detection (check cvCanny or cvSobel).

You should also "pre-process" the image. That is, increase the contrast, make the colors more saturated, etc.

Also check this article http://www.aishack.in/2010/01/an-introduction-to-contours/ It talks about how the squares.c sample works. Then you'll understand a bit about how to improves the detection in your case.

Hope this helps!

Utkarsh Sinha
Hey, thanks so much for the link Utkarsh! So I just focused on one row of my image and i get the following: http://www.learntobe.org/urs/urs.phpHowever, I had another problem: there are multiple contours surrounding each square and I just need the smallest contour for each square. Is this possible?