Adjusting Hue with GSVideo?
in
Contributed Library Questions
•
1 year ago
Hi guys!
Suppose i'll start with an overview of my project.....
So, i'm making a music video that is 4xwider than 720p. This is split up into 4x720 video clips and will be played on 4 imacs using processing with one imac being the server and the others being clients which play the video after hitting 'p' on the servers keyboard. The video is split using after effects into .mp4's which are then transferred to each corresponding imac so that the full video spans appropriately.
To add to this i am wanting to use the iSights on the imacs using camera tracking to adjust the hue of these videos as people are walking past, so say if someone walks to the right the video is pushed more to blue and if they walk left its is pushed more to green maybe. Returning to the default hue when no movement is detected or movement is out of a certain range.
I am using the GSVideo library but i'm having trouble tapping into adjusting the hue. The camera tracking and network connectivity are all sorted and already coded, it is just a case of figuring out how to affect the hue of the videos that are being played.
This is all i have so far in my attempt....anybody any suggestions please?
Suppose i'll start with an overview of my project.....
So, i'm making a music video that is 4xwider than 720p. This is split up into 4x720 video clips and will be played on 4 imacs using processing with one imac being the server and the others being clients which play the video after hitting 'p' on the servers keyboard. The video is split using after effects into .mp4's which are then transferred to each corresponding imac so that the full video spans appropriately.
To add to this i am wanting to use the iSights on the imacs using camera tracking to adjust the hue of these videos as people are walking past, so say if someone walks to the right the video is pushed more to blue and if they walk left its is pushed more to green maybe. Returning to the default hue when no movement is detected or movement is out of a certain range.
I am using the GSVideo library but i'm having trouble tapping into adjusting the hue. The camera tracking and network connectivity are all sorted and already coded, it is just a case of figuring out how to affect the hue of the videos that are being played.
This is all i have so far in my attempt....anybody any suggestions please?
import codeanticode.gsvideo.*;
GSPlayer video;
int off=0;
PImage img;
PrintWriter output;
void setup() {
size(1280,720);
video = new GSPlayer(this, "video.mp4", GSVideo.RAW);
video.loop();
video.volume(0);
img = createImage(1280,720,RGB);
}
void playerEvent(GSPlayer player) {
player.read();
}
void draw() {
if (video.data != null) {
// println("Data size: " + video.data.length);
// println("Data caps: " + video.dataCaps);
img.loadPixels();
byte[] data = video.data;
for (int i = 0; i < img.pixels.length; i++) {
// img.pixels[i] = color(data[i], data[i+156300], data[i+212600]); //These values are found emperically
// int b = int(data[3 * i + 0]);
// int g = int(data[3 * i + 1]);
// int r = int(data[3 * i + 2]);
// int a = int(data[4 * i + 3]);
// img.pixels[i] = color(r, g, b);
// img.pixels[i] = color(data[i], data[i+156300], data[i+212600]); //These values are found emperically
// img.pixels[i] = img.pixels[((img.pixels.length)-1)-i]; //These values are found emperically
img.pixels[i] = color(data[i], data[i], data[i]);
}
img.updatePixels();
image(img, 0, 0, width, height);
}
off++;
if(off>255) off=0;
}
1