filtering cv.jit blobs using jit.op or jit.expr

Let’s say I have an live video stream where I’m tracking a bunch of different blobs using the cv.jit library. I can show a single blob by its blob number using jit.op, e.g.:

"cv.jit.label" >> "jit.op @op == @val 10"

I take the result of the above and multiply it with the original image stream and voila… stream filtered based on blob # (as a side note, using "jit.op @op > @val 0" and multiplying this result with original image stream is a great way to clean up noise/artifacts in the original image).

So my question: I want to be able to select multiple blobs…say 2, 3 and 7, and do so dynamically (might be 1 blob, might be 5, blob numbers will always vary).

There is no set comparison object built-in to jitter in the sense that you can supply a set of numbers and have an op like == applied to them. However, you can easily build something in jit.gen that will do this for you. It won’t handle a dynamic number of blobs though. What you could do is set a max of say 5 blobs you want to track and set the default values for the blob ids to -1 (meaning no blob) and then set them to actual blob ids as you figure out what blobs you want to track.