I’ve done the hard work, turning my iSight camera on my MacBook into an infrared camera, converted it, set the threshold etc.. and now have an image that looks something like this:
My problem is now; I need to know how many blobs are on my image by grouping the white pixels. I don’t want to use cvBlob/cvBlobsLib, I’d rather just use what is already in OpenCV.
I can loop through the pixels and group them by checking for (thresholded) touching white pixels, but I’m guessing there is probably a really easy way of doing this from OpenCV?
I’m guessing I can’t use cvFindContours as this will retrieve all the white pixels in one big array, rather than separating them into “groups”. Could anyone recommend? (Note these are not circles, just the light emitted from little IR LEDs)
Many Thanks in advance!
tommed
Loop through the image looking for white pixels. When you encounter one you use
cvFloodFillwith that pixel as seed. Then increment the fill value for every region so that each region has a different color. This is called labeling.