Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
federay
federay's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
trying to make chroma key
[0 Replies]
22-Jul-2012 09:30 AM
Forum:
Contributed Library Questions
Hi all!
im trying to do a real time chroma key
i have started from an example code that i find in the GSVideo Library
import codeanticode.gsvideo.*;
// Size of each cell in the grid
int cellSize = 1;
// Number of columns and rows in our system
int cols, rows;
// Variable for capture device
GSCapture video;
void setup() {
size(1280, 720, P3D);
//set up columns and rows
cols = width / cellSize;
rows = height / cellSize;
colorMode(RGB, 255, 255, 255, 100);
// Uses the default video input, see the reference if this causes an error
video = new GSCapture(this, 1280, 720);
video.start();
background(0);
}
void draw() {
if (video.available()) {
video.read();
video.loadPixels();
background(0, 0, 255);
// 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 * cellSize;
int y = j * cellSize;
int loc = (video.width - x - 1) + y*video.width; // Reversing x to mirror the image
// Each rect is colored white with a size determined by brightness
color c = video.pixels[loc];
if (red (c) > 70) {
stroke (c);
point (i, j);
}
}
}
}
}
it works but not very well because it check only, i don't understand why, the
brightness of the pixel and not the color
some one can help me?
thanks!
«Prev
Next »
Moderate user : federay
Forum