Syphon / Processing

Syphon Implementation for Processing
Other
137 stars 33 forks source link

slitscan, screen share and syphon #36

Closed panteleimwn closed 2 years ago

panteleimwn commented 4 years ago

Hi i am new to this and very confused i am trying to share a slit scan processing code to another software through SYPHON can you help?

this is the SLITSCAN

import processing.video.*;

Capture video;

int x = 0;

void setup() {
  size (1000, 720);
  video = new Capture (this, 720, 780);
  video.start ();
}

void captureEvent(Capture video) {
  video.read();
}  

void draw () {
  //image (video, 0, 0);
  int w = video.width;
  int h = video.height;
  copy (video, w/2, 0, 1, h, x, 0, 1, h);

  x = x + 1;

  if (x > width) {
    x = 0;
  }  
}   
codeanticode commented 2 years ago

The code was missing the Syphon server initialization and frame sending, should be something like this:

import processing.video.*;
import codeanticode.syphon.*;

Capture video;

SyphonServer server;

int x = 0;

void setup() {
  size (1000, 720);
  video = new Capture (this, 720, 780);
  video.start ();

  server = new SyphonServer(this, "Processing Syphon");
}

void captureEvent(Capture video) {
  video.read();
}  

void draw () {
  //image (video, 0, 0);
  int w = video.width;
  int h = video.height;
  copy (video, w/2, 0, 1, h, x, 0, 1, h);

  x = x + 1;

  if (x > width) {
    x = 0;
  }  

  server.sendScreen();  
}