Capture
===
###### tags: `processing` `Meeting`
:::info
1. Golan Levin
2. loading image
3. capture and live video
4. Using the Movie Object for Displaying Recorded Videos
5. Slit-Scan Video
-------
5. color tracking
6. multi color tracking
:::
:dart: Golan Levin
---
http://www.flong.com/projects/messa/
https://www.ted.com/talks/golan_levin_ted2009?language=en
:dart: loading image
---
PImage img;
int value = 0;
void setup() {
size(800, 600);
img = loadImage("testing.jpg");
}
void draw() {
image(img, 0, 0);
image(img, 0, 0, width/2, height/3);
if (key == 0) {
saveFrame("catch-####.png");
//save each frame as catch-0001.png, catch-0002.png
}
}
//void keyPressed() {
// if (value == 0) {
// saveFrame("catch2-####.png");
//}
:dart: capture and live video
---
//import library
import processing.video.*;
Capture video;
void setup(){
size(640, 480);
//referring this processing sketch
video = new Capture(this, width, height, 30);
//tell video to begin
video.start();
}
void draw(){
image(video, 0, 0);
//image(video, 0, 0, mouseX, mouseY);
}
//keep reading(trigger) camera whenever there's an event
//void captureEvent(capture video){
//video.read();
//}
//read camera when we press mouse
void mousePressed(){
video.read();
}
:dart: Displaying Recorded Videos
---
//"jump" is an important funnction for playing the video.
//import library
import processing.video.*;
Movie video;
void setup() {
size(640, 480);
video = new Movie(this, "play_testing.mov");
//video.play();
video.loop();
//video.speed(4);
}
void draw() {
//map(value, start1, stop1, start2, stop2)
float r = map(mouseX, 0, width, 0, 4);
video.speed(r);
image(video, 0, 0);
}
void mousePressed() {
//jump to 5 sec in the video
video.jump(5);
}
void movieEvent(Movie video) {
video.read();
}
:dart: Slit-Scan Video
---
import processing.video.*;
PImage webcam;
Capture video;
int x = 0;
void setup() {
size(640, 240);
background(0);
// printArray(Capture.list());
video = new Capture(this, 320, 240);
video.start();
}
void draw() {
image(video, 0, 0);
int w = video.width;
int h = video.height;
//copy(src, sx, sy, sw, sh, dx, dy, dw, dh)
copy(video, w/2, 0, 1, h, x, 0, 1, h);
x= x+1;
if (x>width) {
x=0;
}
}
void captureEvent(Capture video) {
video.read();
}
:books: Notes
---
11.3: Slit-Scan Video - Processing Tutorial
https://www.youtube.com/watch?v=WCJM9WIoudI&list=PLRqwX-V7Uu6bw0bVn4M63p8TMJf3OhGy8&index=3
http://www.silentlycrashing.net/p5/libs/video/