We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Slitscan Questions (Read 1259 times)
Slitscan Questions
Oct 14th, 2008, 9:37pm
 
My buddy and me are prototyping an installation involving a slitscan installation. Read an overview and watch a first fieldtesting here -> http://cmdstud.khlim.be/~jbollansee/blog/2008/10/12/public-space-concept-toughts/

We are basically using the slitscan example code (so no need to post that here). Is there a way to rewrite that code so the images "flows" instead of having a line that's running over the screen?

Thanks in advance!
Re: Slitscan Questions
Reply #1 - Oct 15th, 2008, 1:22am
 
not sure what you mean exactly by 'flows'... but I thought i'd post this resource on slitscan anyway:
http://www.flong.com/texts/lists/slit_scan/

probably doesn't answer your question directly, but anyone interested in slitscan should see it I think!
Re: Slitscan Questions
Reply #2 - Oct 15th, 2008, 10:19am
 
Thanks for the reading material - definately a good resource.

So let me rephrase my question:
Right now the example code produces a "line" running over the screen - slowly updating the image - it runs to the end of the canvas / screen - and then starts from the beginning again. So - instead of a scrolling line - we would like to have a scrolling image.
Re: Slitscan Questions
Reply #3 - Nov 3rd, 2008, 9:53pm
 
Did you ever have any luck with your task? I posted a similar question about the same slitscan example. I want it to stack vertically instead of horizontally but no replies were made.

Re: Slitscan Questions
Reply #4 - Nov 4th, 2008, 1:09am
 
This sketch:

1. starts off by drawing to the end of the sketch
2. shift all pixels one to the left (with the nifty shift function provided)
3. draw newest line / slitscan on the end

I haven't added cam-functionality to this, but I think you get the idea..

Quote:
boolean isScrolling = false;
int xStep = 0;
void setup()
{
  size(400,400);
  background(0);
}

void draw(){
  if(isScrolling){
    shiftPixels(-1, 0);
  }

  stroke(random(255),random(255),random(255));
  line(xStep,0,xStep,height);

  if(!isScrolling){
    xStep++;
    if(xStep == width-1){
      isScrolling = true;
    }
  }
}

void shiftPixels(int xOff, int yOff)
{
  loadPixels();
  for(int i = -xOff; i < width; i++){
    for(int j = -yOff; j < height; j++){
      int to = (i+xOff)+(j+yOff)*width;
      int from = i+j*width;
      if(to >= width*height || to < 0 || from >= width*height || from < 0){
        continue;
      }
      pixels[to] = pixels[from];
    }
  }
  updatePixels();



For a little extra interactivity in my example:
replace -1, 0 with ceil((mouseX-width)/10),ceil((mouseY-height/2)/10)

seltar
Re: Slitscan Questions
Reply #5 - Nov 4th, 2008, 5:52am
 
nice work! I'm going to see if I can get the video to work with it - if you do please let me know! The mouse input variation is awesome!
Re: Slitscan Questions
Reply #6 - Nov 4th, 2008, 11:02am
 
Whoa man, thanks a whole lot!
This is exactly what I need, I think.
Will check it out after breakfast.

I tried to do the shift fuction
(following the same basic concept you outlined here)
using the image copy functionallity in processing some days ago, but that did not work out well.

Thanks a lot again!
Much appreciated.
Re: Slitscan Questions
Reply #7 - Nov 6th, 2008, 7:48am
 
this works with video but it's very slow and the video camera need to be off center - there should be a more efficient way...

import processing.video.*;
Capture video;

int videoSliceX;
int drawPositionX;
boolean isScrolling = false;
int xStep = 0;

void setup() {
 size(320, 240);
 
 video = new Capture(this, 320, 240, 30);
 
 background(0);
}

void draw() {
  if(isScrolling) {
   //shiftPixels(ceil((mouseX-width)/10),ceil((mouseY-height/2)/10) );
   shiftPixels(-1, 0);
 }
 if (video.available()) {
   video.read();
   video.loadPixels();
 }
 
 stroke(random(255),random(255),random(255));
 line(xStep,0,xStep,height);
     if(!isScrolling){
   xStep++;
   if(xStep == width-1){
     isScrolling = true;
   }
 }
}
   void shiftPixels(int xOff, int yOff) {
   loadPixels();
for(int i = -xOff; i < width; i++){
   for(int j = -yOff; j < height; j++){
     int to = (i+xOff)+(j+yOff)*width;
     int from = i+j*width;
     if(to >= width*height || to < 0 || from >= width*height || from < 0){
       continue;
     }
   for (int y = 0; y < video.height; y++){
     int setPixelIndex = y*width + xStep;
     int getPixelIndex = y*video.width  + xStep;
     pixels[setPixelIndex] = video.pixels[getPixelIndex];
   }
   pixels[to] = pixels[from];
   }
  }
   updatePixels();
}

Re: Slitscan Questions
Reply #8 - Nov 14th, 2008, 12:11pm
 
Hey Guys,
This is my code as of now.

It is indeed very slow now. I had to reduce the video capture and my display screen to somehting that is only 60 pixels in height to get acceptable performance on my Powerbook G4. Video capture also complains about not having more then one processor thread to work with.

If i switch to full screen (using library) i'm back at Dog Slow again.

Anyway - this will suffice for my aim right now: explaining and showing a very basic prototype to my teachers.

Anyhow - improvement in the code is certainly possible (altough i also read that the processing video capture library is certainly a slow one) but not my priority right now.

Thanks for all the help!
I'm sure i'll be returning soon to this developement community.

Code:

/*
Slitscan Project for Public Space @ C-MD
By Jim Bollansée
Using Code & Expertise of Olmo Claessens, Lievn Menschaert
Golan Levin and Seltar @ The Processing Forums
Some Rights Reserved 2008
*/

import processing.video.*;
Capture video;

import fullscreen.*;
FullScreen fs;

int videoSliceX;
int drawPositionX;
int windowSizeX;
int windowSizeY;
int FPS;


void setup() {
 FPS = 24;
 frameRate(FPS);
 //video = new Capture(this, 640, 480, FPS);
 video = new Capture(this, 80, 60, FPS);
 //video.settings();
 videoSliceX = video.width / 2;

 int windowSizeX = 400;
 int windowSizeY = 60;
 size(windowSizeX, windowSizeY);

 drawPositionX = windowSizeX-1;
 background(0);
 
   //fs = new FullScreen(this);
   //fs.enter();
}
void draw() {
 drawSlitScan();
 shiftPixels(-1, 0);
}

void drawSlitScan ()
{
if (video.available())
 {
video.read();
   video.loadPixels();
   loadPixels();
   for (int y = 0; y < video.height; y++){
     int setPixelIndex = ((height-video.height)/2+y)*width + drawPositionX;
     int getPixelIndex = y*video.width  + videoSliceX;
     pixels[setPixelIndex] = video.pixels[getPixelIndex];
     updatePixels();
         }
 }
}


void shiftPixels(int xOff, int yOff)
{
 loadPixels();
 for(int i = -xOff; i < width; i++){
   for(int j = -yOff; j < height; j++){
     int to = (i+xOff)+(j+yOff)*width;
     int from = i+j*width;
     if(to >= width*height || to < 0 || from >= width*height || from < 0){
       continue;
     }
     pixels[to] = pixels[from];
   }
 }
 updatePixels();
}
Page Index Toggle Pages: 1