eduardolundgren / tracking.js

A modern approach for Computer Vision on the web
http://trackingjs.com
Other
9.43k stars 1.44k forks source link

Change color of Draw Something line. #186

Closed blepage closed 7 years ago

blepage commented 7 years ago

Hello how can you change the color of the line produced by the color tracker within Draw Something example. Help would be much appreciated. Code is standard to initial build.

eduardolundgren commented 7 years ago

Yes you can register a new color rule or using the existing ones. To register a new color you can do:

tracking.ColorTracker.registerColor('myColor', function(r, g, b) {
  if (r < 50 && g > 200 && b < 50) {
    return true;
  }
  return false;
});

On the example you can just change it here to the new color name, https://github.com/eduardolundgren/tracking.js/blob/master/examples/color_draw_something.html#L64.