How to use color codes

We recently saw our tournament venue, and there is a giant blue wall behind the field. We spent months working on vision code, and there is a ton of interference. If we could use color codes, looking for the flag color + the green on the flag, our program would work great. However, whenever we try to use color codes, our object count is usually zero. Has anyone successfully used color codes?

see this

1 Like

Okay, it almost seems like I must be doing something wrong then. If I use vision.takeSnapshot(0); , will it return a table with the individual signitures or the codes?

takeSnapshot is a filtering function, meaning that if you ask for a snapshot of SIG_1 it will move everything it has found with that signature into the vision.objects array. Using takeSnapshot(0) would give you everything (up to the limit we have set which IIRC is 16 objects), any signatures and color codes found. You would then have to filter the array and decide what was relevant yourself

1 Like

Okay, thanks @jpearman. I’m still having the issue of objectCount being zero after using vision.takeSnapshot(color code), but I guess that must be something on my end.

If objectCount is 0 then the color code is not being detected. To be honest, the turning point flags are not that easy to work with. Try to get the code working with something like I used in the demo, then when you have the code working try and configure the vision sensor to work with flag., It may just be that the green part of the flag is too small at the distances you want to detect it at. The vision sensor will ignore detected objects below a certain size, however, if you can see the color code object being detected well in the vision sensor utility the user program should also be able to get that information.

1 Like