Hi,
I want to make an RGB LED matrix with arduino that shows whatever the camera is getting,
My first step is to have my video "pixelated",
I found an awesome example by Daniel Shiffman [Learning Processing],
But my problem is that I need a square screen to translate this to my LED matrix array, [8x8, 16x16...]
this is the code im using from exercise 16-7 video pixelation
- // Learning Processing
- // Daniel Shiffman
- // http://www.learningprocessing.com
- // Example 16-7: Video pixelation
- import processing.video.*;
- // Size of each cell in the grid, ratio of window size to video size
- //int videoScale = 8;
- int videoScale = 16; //20 columns ; 15 rows
- //int videoScale = 32; //20 columns ; 15 rows
- //int videoScale = 64; //10 columns ; 7 rows
- // Number of columns and rows in our system
- int cols, rows;
- // Variable to hold onto Capture object
- Capture video;
- void setup() {
- size(640,480);
- // size(500,500);
- // Initialize columns and rows
- cols = width/videoScale;
- rows = height/videoScale;
- video = new Capture(this,width,height);
- video.start();
- }
- void draw() {
- // Read image from the camera
- if (video.available()) {
- video.read();
- }
- video.loadPixels();
- // Begin loop for columns
- for (int i = 0; i < cols; i++) {
- // Begin loop for rows
- for (int j = 0; j < rows; j++) {
- // Where are we, pixel-wise?
- int x = i*videoScale;
- int y = j*videoScale;
- // Looking up the appropriate color in the pixel array
- color c = video.pixels[x + y*video.width];
- fill(c);
- stroke(0);
- rect(x,y,videoScale,videoScale);
- }
- }
- }
so I need a square screen
if I use :: size(500,500);
I get the error:
So, how to fix this to have my square size screen?* (Processing core video:46085): WARNING **: ColorConverter: size 512000 is not a multiple of unit size 500000
Thanks!