Blob Tracking - New ID

Hi everyone!

My apologies if this is not the right place to ask this question (I realize this isn’t an openCV forum), I’m very new to openframeworks and programming in general.

What I’m trying to do seems very simple, but I’m having a hard time figuring out the logic and the language to implement it. I am using blob tracking in openCV and I would like to assign a random color fill to each new blob that I find. As it stands, I’ve modified ofxCvBlobTracker.cpp to expect arguments for color in the draw function and I’m assigning random variables via my main draw loop. Of course, this is changing the color of the blob in every frame and giving me a lovely rainbow effect, but not what I’m looking for. I know I’ll need to write something along the lines of “when a blob is assigned a new ID, fill it with a random color and keep it,” possibly in the blobOn() event. If anyone can offer any advice on what this language would be, I’d be greatly appreciative!

You can store the blobs in an array of blobs, if there’s a new blob (different x, y, width, height) you add it to the array if not you discard it. So now you draw the array of blobs… I guess that’s a good approach but maybe someone has a different idea (hope so)