Movie movie; Slit Scan
in
Core Library Questions
•
2 years ago
/**
* Simple Real-Time Slit-Scan Program.
* By Golan Levin.
*
* This demonstration depends on the canvas height being equal
* to the video capture height. If you would prefer otherwise,
* consider using the image copy() function rather than the
* direct pixel-accessing approach I have used here.
*
* Created December 2006.
* Updated September 2011 by James Hale.
*/
import processing.video.*;
Capture video;
int videoSliceX;
int drawPositionX;
void setup() {
size(1000, 480, P2D);
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, 1000, 480, 30);
videoSliceX = video.width / 2;
drawPositionX = width - 1;
background(0);
}
void draw() {
if (video.available()) {
video.read();
video.loadPixels();
// Copy a column of pixels from the middle of the video
// To a location moving slowly across the canvas.
loadPixels();
for (int y = 0; y < video.height; y++){
int setPixelIndex = y*width + drawPositionX;
int getPixelIndex = y*video.width + videoSliceX;
pixels[setPixelIndex] = video.pixels[getPixelIndex];
}
updatePixels();
drawPositionX--;
// Saves your image if pixels reach the end of the frame
if (drawPositionX < 0) {
saveFrame();
drawPositionX = width - 1;
}
// Takes another photo if you click the mouse.
if(mousePressed) {
drawPositionX = width - 1;}
}
}
this is a slitscan program i updated to save images and restart the photo by clicking
I have been working on and researching all day how to get Movie movie to break down into pixels then load pixels the same way as a slit scan, so i could use a movie file rather than the built in camera on my computer.
Does anyone knows what i need to change to call the movie in and get it to only display the center pixels
Thank you very much
2