# Blob detection in C

I am trying to do my own blob detection. My program will receive a real time video, and try to detect a white paper sheet, even if something is written on the paper.

I need to detect the paper and its corner, because what I really want is to draw a opengl polygon over the paper, such that each corner of the paper will be a corner of the polygon. Then, I need the coordinates of the paper to do other operations. So, I need to:

• detect a square white blob
• get the coordinates of the corners
• draw a polygon over the white sheet

Any ideas on how can I do that?

-
have a look at hessian filter based approach. – crack_addict Jul 5 '12 at 3:15
by now nothing. I want to change the artoolkit library to detect the white sheet who had the marker i want to draw a opengl polygon over the paper, not only over the marker, the marker will be drawing another stuffs. – Ruben Veiga Jul 8 '12 at 17:25
Are you trying to do this without the help of OpenCV? – Ivo Flipse Aug 1 '12 at 9:12

I have recently implemented something like this. I would take the following approach. This assumes the paper is the in the image but there are no other objects. For example a scanner application for iPhone where the user places the paper and hits photo taking button.

1. Pass the image through first an edge detector and later binary thresholder and make the image binary
2. Use a connected component detection algorithm (any one is fine) to detect the objects and find the extreme coordinates of each object.
3. You can detect parallelism among the 4 corners of any object and this would translate into a mathematical equation where you can see if it is a rectangle and if rectangle, draw the polygon based on 4 corners.
-
This was a method suggested in Algorithms Part II by Professor Robert Sedgewick as well. So more details on the method/code are available in the course. – Naresh Apr 2 '13 at 5:48

I would suggest you try HSV space thresholding. What I mean is convert the image to HSV space and set a threshold on either 1) H-channel or 2) combined threshold on H, S channel. I am suggesting this approach since the object you detect is of a particular color.

If you are using opencv you can use the function cvCvtColor() to convert to HSV color space. If you want your own stand alone implementation, conversion formulars for RGB to HSV may be found here : http://en.wikipedia.org/wiki/HSL_and_HSV

-