import processing.serial.*; import processing.video.*; int cellSize = 20; int cols, rows, cellN; int[] colorValues = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Capture video; void setup() { size(640, 480); frameRate(10); colorMode(HSB, 100, 100, 100); cols = width / cellSize; rows = height / cellSize; cellN = (cols)*(rows); //colorMode(RGB, 255, 255, 255, 100); video = new Capture(this, width, height); video.start(); background(0); } void draw() { if (video.available()) { video.read(); video.loadPixels(); for(int i = 0; i 20 && briVal < 80) { colorValues[int(hueVal/8.3)]++; } else if(briVal <= 20) { colorValues[12]++; } else if(briVal >= 20) { colorValues[13]++; } pushMatrix(); translate(x+cellSize/2, y+cellSize/2); rectMode(CENTER); fill(c); noStroke(); rect(0, 0, cellSize+6, cellSize+6); popMatrix(); } } // Print colors percentage values for(int i = 0; i