Im using opencv 2.0 with cvblob.h in VS2010 and I made a program that detects yellow blobs. Now what I want to do is to number those blobs, no matter if they move. I know that the label property is useful for number them, but I've tried it and when one blob is moved, the labels change. How can I hold the "initial" label numbers?

有帮助吗?

解决方案

What you want is to track blobs. Tracking blobs means that you keep track of blobs from frame to frame. This way, you will have a number that identified moving objects (blobs over time).

To do that you must code your own tracking algorithm (based on your specific problem) or use the tracking functions that comes with cvBlob, which are far from perfect but useful for testing purpose.

You have code samples in cvBlob package. In particular:

http://cvblob.googlecode.com/svn/trunk/samples/red_object_tracking.cpp http://cvblob.googlecode.com/svn/trunk/test/test_tracking.cpp

其他提示

By saying that you want the blobs to hold on to their initial labels, you are essentially trying to track them. That would amount to implement a multiple object tracking system. Believe me it's not as simple as you think.

You need to establish some sort of correspondance between the frames.

In case the blobs does not vary too much between the frames you can try finding geometrical centers of each blob in one frame and in the susequent frame you can try finding a blob nearest to a center found in previous frame. Then assign the previous label to the new blobs. And so on so forth...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top