Doubts about Color Tracking example code

1 reply [Last post]
victorfdez
User offline. Last seen 8 years 50 weeks ago. Offline
Joined: 06/13/2012
Posts:

Hi Brad Larson,

Your example application was very useful to me. But I have a problem, I'm pretty new on this and I want to change the white color to red. The white color I'm referring is the one you used on the threshold method to exchange with the color selected. How can I change this to red? Thanks in advance.

Regards

Brad Larson
Brad Larson's picture
User offline. Last seen 4 years 22 weeks ago. Offline
Joined: 05/14/2008
Posts:

In the ColorObjectTracking example, look at the Threshold.fsh fragment shader, which is what does the color replacement in this case. The simplest way to modify this shader to do what you want is to replace the vec4(1.0) vector in the last ternary operator within the maskPixel() function with a vec4 containing your target color. For red, that would be vec4(1.0, 0.0, 0.0, 1.0).

Syndicate content