Blob detector

From HotDec

Jump to: navigation, search

Getting the Code

 svn co svn://legend.me.uiuc.edu/hotdec/trunk/feanil/cv_blobslib_OpenCv_v4 

The Code for the blob detector is written on top of the OpenCV blob detection library. Although it does not use the algorithm provided by this library.

The Algorithm

The algorithm works as follows. First we mask the image so that only certain color ranges are visible. For our purposes these would be, a range of red, blue and green that represents the craft tops as seen by the camera. The colors are in terms or ranges due to all the different types of noise that exist during the capture process. Once we have a masked image we move throug the image pixel by pixel. When we encounter a pixel that is within the color range that we care about we queue it and mark it. Then while the queue is not empty we keep adding adjacent pixels of the same color to the queue and marking them until the queue is empty and thus we have found a blob. Doing this to the entire image we have a list of blobs of varying types tha can be found in the photo.

Here is a photo of the blobdetector find blobs in an image from one of the overhead cameras. Image: BlobDetect.jpg

Making Changes

The Blob detection algorithm is very modular and making changes to different aspects is quite easy. The algorithm consist of a main function which searches through the masked image looking for the blobs. The maskHandler() which assigns different image types different maskers. And the Maskers for the different image types. Currently there is only an RGBmasker which maskes rgb images. If at any point we want to change what colors to mask, it would be as easy as changing the RGBmasker's helper function colorRange(). This function takes in a hue value as input and returns the masked value assigned to that color value. Currently it only accepts the hue values for red, green, and blue close to the red, green and blue values that are read from the hovercraft tops, and discards all other colors so that they are not used for the blob detection. In the picture above you will notice a very prominent yellow blob which gets ignored as it is not one of the colors we are looking for. To add this color to the list of accepted colors it would be as easy as changing the colorRange() function.

Personal tools