Detect color in region (contour +colortracker functions)

I want to detect objects from a VideoIn using a mask or regions like Trautner. However, I want to be able to track colors on the regions instead of greyscale change.

How do I detect colored objects in discrete regions and generate a spread that tells me what color(s) are in each region?

I tried using colortracker node, but the ROI is not spreadable.

The only way I can think of is to use the colortraker and use => =< to check all the regions or maybe do a check with pipet?. I was hoping for a more elegant way. Anyone have any suggestions?

please see attached for a visual illustration of what I’m trying to do.

thanks!

detect_color_problem.v4p (10.6 kB)

qwiks, ROI being definable, you may spread it !
what you want to do is completely doable only with colortracker and its output pin IsTracked:

OUTPUT PINS:

  • X,Y: Positions of the object

  • Height, Width: principal and second axis of inertia. (Object height and width if object
    stands upright and height>width)

  • IsTracked: Is set to ‘1’ if object size exceeds Area Threshold, and ‘0’ else.

qwiks, ROI being definable, you may spread it !

I put a spread of values into ROI and looked at the colortracker inspector. The spread is not received, only the first value is passed. How can I put a spread into ROI?

Please give me more details.

thanks

Colortracker’s ROI is not spreadable. CamShiftTracker’s ROI is spreadable.

I’m still confused though. as far as I can tell:

CamShift identifies different colors but does not let me choose which ones I want it to identify. I want it to only detect only 4 specific colors.

Colortracker lets me choose what color I want to identify but its ROI is not spreadable.

any thoughts about this?

Whats about using your sample patch and putting a shader in front of it, which converts a specific color (your four colors) into a defined gray value. May be for each region a different - 4 colors x 6 regions are 24 grayvalues to track by trautner then.

Trautner only identifies a change in greyscale value. It does not output any information on greyscale except that the pixels have changed. The output contains no identifying information So it would not work.

I’m starting to think pipet or creating a long chain of boolean statements for colortracker is the only way here.

Any coders out there want to make colortrackers ROI spreadable?
I don’t understand why its not spreadable in the first place :)

Oh sure, I forgot it.
May be attached patch is a help.

HowPipetWorks.v4p (20.5 kB)

damned! you are right qwiks !

@frank

Oh thanks! that patch is super helpful. It didn’t take me very long to modify it for my needs. Pipet should work! It’ll be much less intensive for the CPU compared to Colortracker as well.

I still wish Colortracker’s ROI was spreadable though ;)