Im looking to take a video input, look at certain areas, the when a specific action happens in 2 areas of the screen, get touch design to fire a command. Forgive me because I am very new to TD.
In my testing the area is only ever black or white so my thought path:
Video In →
Crop area A of interest →
analyse A →
toptochop A (to convert colour to number)
Crop area B of interest →
analyse →
toptochop (to convert colour to number)
if A+B = 0 do action
if A+B = 1 do action
if A+B = 2 do action
Is this a really silly way of attempting things?
I can get most of the way through my theory. except when i get to the toptochop 1hich gives me 1,1,1,1 and black gives me 0,0,0,0 - great. i use math to merge them but get 1r or 0r which i can’t perform math on.
Would it be better to the choptodat then use a python expression to do the rest? For context the final output will be a websocket or xml file (both of which i have working)
If there is some reading i can do i’m more than happy if someone can point the way. Many thanks and all the best.
If I’m understanding it properly, it should all work, you just need to set ‘Combine CHOPs’ to Add in the Math CHOP to add the values from your two TOP to CHOPs
to be precise the video capture is a full screen google meet. the cropped area is the raise hand logo that pops up. for context if its used i want to be able to fire a POST request.
I took a quick look at the file and the only real change is that you only need one math chop at the end and then you connect both chop paths to it and set the ‘Combine Channels’ to Add like in my image above.
You might also find either the quantize feature on the Limit CHOP or the Logic CHOP to be useful for converting your colour values into more discrete values (i.e. 0, 1 & 2) and then you can use a CHOP Execute DAT to run a script when that changes.
One other suggestion, if you leave the Green. Blue and Alpha fields blank in the TOP to CHOP nodes then you’ll only get one channel in the output so you don’t need the extra delete or analyze chops.
You can also treat a pixel rgb color as an xyz position, and measure the “distance” between two colors aka positions and when the distance is less than a certain threshold use a logic chop to go from 0 to 1, etc.
Can subtract current color from desired color for instance with a math chop, then using another math chop set to combine channels with distance you can get a single scalar to feed that logic chop.