We are about to switch to a new forum software. Until then we have removed the registration on this forum.
i tried to adjust a slit scan video code to move the copy command from left to right through the video. that works, but in the output it skips a position, leaving a white strip between. how can i make the output dense?
import processing.video.*;
Movie myMovie;
int pos;
int sliceSize = 5;
int outputcounter= 1;
String date;
void setup() {
size(5000, 720);
myMovie = new Movie(this, "versuch1.mp4");
myMovie.loop();
pos = 0;
date = timestamp();
//myMovie.jump(176);
}
void draw() {
if (myMovie.available()) {
myMovie.read();
pushMatrix();
for (int i=0; i<1280; i+= sliceSize){
//translate(width/2, height/2);
//rotate(HALF_PI);
//translate(-width/2, -height/2);
//tint(255, 20);
copy(myMovie, i, 0, sliceSize, myMovie.height, pos, 0, sliceSize, height); //(copy (quelle, x , y, breite, höhe, position im neuen bild, ))
scale(-1,1);
pos+=sliceSize*i; //horizontal gefilmt
//copy(myMovie, 0, myMovie.height/2, myMovie.width, sliceSize, 0, pos, width, sliceSize); //vertical gefilmt
//pos-=sliceSize;
if (pos>width) {
saveFrame("png/"+ date+"/"+nf(outputcounter,3)+".png");
outputcounter++;
pos = 0;
}
}
//image(myMovie, 0,0,960,540);}
popMatrix();
}
}
// Called every time a new frame is available to read
/**void movieEvent(Movie m) {
m.read();
}*/
void keyPressed() {
if (key == 32) {
saveFrame("png/output_"+timestamp()+".png");
}
}
String timestamp() {
return new java.text.SimpleDateFormat("yyyy_MM_dd_kkmmss").format(new java.util.Date ());
}
//webseite 100vh quadrat (3/4=133) png= 001.png, 002.png
Answers
nothing
Before you start working with s wider strip, try using the original example. Keep in mind you are using a screen width of 5000 pixels. And you are saving many frames. All these features are working but are irrelevant to your problem. Reduce your program to a minimum code that reproduces the error.
Kf
hey, thank you. i worked on it a bit more. i got a friend to take a look at it. it is supposed to work i believe. but there are grey gaps in between the positions. i think it overjumps certain position, but it all seems wild to me.
that assumes that a new movie frame is available every time draw is called. which i don't think is true.
i think you need to get rid of the reliance on frameCount
also, line 19 is missing a ;
maths here is probably wrong also - you are going WAY off the screen - i might be 1280 * sliceSize. you probably want (width / sliceSize) instead of 1281. but this fix will break your condition in line 20...
hey koogs, thanks for looking at my script closely. i adjusted a lot of things. I tried to establish the framerate of the movie and of draw to 1. but it does not work. after 1/10th of the rendering, the movie is already over. i estamate, the movie plays in normal speed. do you know an option, how i can adjust the copy command with every frame read?
there is also: i adjusted the sliceSize to the speed of the movement from left to right: width/total frames.
okey, got it. here is my latest update. i started using movieEvent, for controlling the scan on the x axis in relation to every frame. now i still have the problem of adjusting the speed of the video with the total number of frames in the video. so i reach the end of the canvas, when the movie ends. and also. sometimes it does not copy and in the output there is just a white bar.