Hi my friends,
I am a newbie. Could anybody give me some idea on this topic? There is a primary slit, which divides into grids, then each grid is divided into horizontal pieces.
I try to follow the tutorial on slit scan topic:
but i could not find out a way to loop through secondary divide.
here is the code
import processing.video.*;
// Movie came;
Capture cam;
// PImage setup
int scl = 2;
int hSlit = 5;
int w, h, hsNum;
PImage[] historyImage;
int historyIndex = 0;
int offset = 0;
PImage[] sliceImage;
void setup()
{
size(640, 480);
String[] cameras = Capture.list();
printArray(cameras);
cam = new Capture(this, cameras[0]);
cam.start();
w = width/scl;
h = height/scl;
hsNum = h/hSlit;
historyImage = new PImage[scl*scl];
for(int i = 0; i < historyImage.length; i++)
{
historyImage[i] = createImage(width, height, RGB);
}
background(0);
}
void captureEvent(Capture cam)
{
cam.read();
}
void draw()
{
int count = 0;
for(int i = 0; i < scl; i++)
{
for(int j = 0; j < scl; j++)
{
int currentIndex = (count+offset)%historyImage.length;
image(historyImage[currentIndex], i*w, j*h, w, h);
count++;
// to create a slicing effect in each divided grid
sliceImage = new PImage[hsNum];
for(int k = 0; k < sliceImage.length; k ++)
{
sliceImage[k] = new PImage(w, hSlit,RGB);
int y = k*hSlit;
sliceImage[k].copy(historyImage[currentIndex], 0, y, w, hSlit, 0, y, w, hSlit);
image(sliceImage[k], 0, 0);
}
}
}
offset++;
historyImage[historyIndex].copy(cam, 0, 0, width, height, 0, 0, width, height);
historyIndex= (historyIndex+1)%historyImage.length;
}