I am trying to speed up the image processing for a target tracking application that I am developing for my thesis. The image processing takes the following steps:
Import color image and grayscale background
Convert the color image to a grayscale image
Subtract the background
Threshold resulting grayscale image (resulting in a binary image)
Label each “blob” in the image (Reference: Connected Component Labeling)
Calculate the properties of the different blobs (Reference: Area/Centroid Blob Analysis)
The first few steps were relatively trivial to implement, but the last two are a bit more difficult. I found a way to perform uniquely label each blob, but the blobs are labeled in a non-sequential way. For example, if there are only three blobs in the image, they may be labeled 23653, 142, and 8907 instead of 1, 2, and 3.
I have a few questions:
Is there an efficient way to perform the last step (area/centroid calculation) with the non-sequential numbers I have generated?
Is there an efficient way to relabel my Connected Component Labeling matrix into sequential numbers (starting at 1)?
Does anyone know a way to solve the connected component problem by generating minimized numbers for the blobs (instead of my large, non-sequential ones)?
What is an efficient way to calculate the area and centroid for each (labeled) “blob” in the image?
Right now I am using a GeForce 8800 GTS (compute capability 1.0), but in a couple of weeks I will be getting a new computer with a GeForce GTX 280 (compute capability 1.3).
Let me know if you need to see my current code in order to answer. Thank you!