Custom Search

Thursday, February 26, 2009

cvFindContour problem

My first algorithm for blob detection was to read through all the pixels and find the bright spots. This was slow and no matter how I optimised my code, I was unable to go above 60fps. The bottle neck was the for loop that reads all the pixels.
As a result I changed it to use cvFindContours. This is much faster and after making some changes, I was able to go up to 120fps!
Then came a problem. I was detecting the same coordinates for 2-3 frames before the blob was detected in its new position. This effectively gave me many problems with new blobs and old blobs being generated instead of 1 blob moving across the screen.
A colleague of mine told me that he saw no problem with my code and he encountered this problem before. It is due to the motion compensation process in the video decoder and not opencv.
He worked around this by detecting and ignoring duplicate frames. Does anyone have any other ideas ?

No comments: