color tracking and masking for multiple objects

    Dec 10 2011 | 12:06 am
    i have a friend who would like a patch that is able to identify all of the red objects in a video and mask everything else in the frame. i've used the basic color-tracking features in jitter before, but i'm not sure how to integrate it to work with multiple objects of a similar color or how to make a mask that conforms to the shape, rather than producing a rectangle around the color. i know that the objects have some things that might be functional for this purpose, but i'm not totally sure how to implement them. any advice would be greatly appreciated. thanks!

    • Dec 10 2011 | 8:58 pm
      the cv.jit objects will work if you can get the red to become white, that is, if you can get a high contrast between them and the surrounding areas. Might not work very well in a typical scene, cv.jit is great for things like infrared LEDs where there's super high contrast, but if things are more on a spectrum, there's lots of thresholding. Just the way it works.
      For multiple color tracking you might try the demo, I was able to get its tracking working on several blobs of the same/close color, it supports up to 4 (at least when I tried it). Or maybe Cyclops can do this too. Both cost a bit though.
      All that said, you may be able to do what you want by honing into the color in question and running a jit.op on it. If the colors are pretty solid, this could work well...if they're really red, you might be able to use just the red plane, then mask everything below a certain (fairly high) threshold.