Hi sorry, very new to programming, so I’m trying to create a script that captures frames of a video and arranges them on a grid (60x130)
int xpos = 0;
int ypos = 0;
int VWIDTH = 8; // width of capture
int VHEIGHT = 6; // height of capture
int MOVIEWIDTH = VWIDTH * 60; // width is equivalent to 1 minute of film time
int MOVIEHEIGHT = VHEIGHT * 130; // 130 minutes
int MAXWIDTH = MOVIEWIDTH - VWIDTH;
int MAXHEIGHT = MOVIEHEIGHT - VHEIGHT;
boolean capture = false;
boolean newFrame = false;
void setup()
{
surface.setSize(MOVIEWIDTH, MOVIEHEIGHT);
background(0);
}
void mousePressed() {
// click screen to start capture
// click again to take screengrab if required
if (capture == false) {
capture = true;
}
else {
saveFrame();
}
}
void videoEvent()
{
newFrame = true;
}
void loop()
{
if(newFrame && capture==true) {
image(img,xpos, ypos);
xpos += VWIDTH;
if (xpos > MAXWIDTH) {
xpos = 0;
ypos += VHEIGHT;
}
if (ypos > MAXHEIGHT) {
saveFrame();
ypos = 0;
background(0);
}
newFrame = false;
}
}