Happy Coding

Kinect and processing 3 thesis project

#1
Hi! Im attempting to produce a fairly simple art piece for my senior thesis as a visual artist. What I basically want to do is project a video onto the wall, and use the Kinect as a proximity sensor (its all I have available atm), I want the audience’s proximity to alter the speed, and possibly colors of the video. The Kinect I have is V1 1414, and I got it to work on processing well, as well as edit the minimum and maximum threshold.

I was also able to play the video from the laptop, and be able to alter the speed (didn’t get to color yet). but am finding difficulties in connecting the two elements, as in if the Kinect sees the offset depth within the threshold the program would speed up the video, and if there are no objects then the video speed to continue normally.
what is happening now is that the video plays at normal speed when I am closer than the given threshold, otherwise it doesn’t even play
I am a beginner in processing, in fact the only experience in coding I have was with C++ and in middle school (safe to say I don’t remember much)
If anyone can help I would be eternally grateful,
I apologize for the messy code, as I mentioned I have no experience with this and am trying to learn on the job…

(for some reason the < / > function is not working, so here is my code)

import processing.video.*;

import org.openkinect.processing.*;

Movie movie;
Kinect kinect;

float minThresh = 480;
float maxThresh = 830;

PImage img;

void setup() {
size(720, 480);
frameRate(24);
movie = new Movie(this, “vid.MP4”);
movie.loop();
movie.speed(1.0);

kinect = new Kinect(this);
kinect.initDepth();
}

void draw() {
background(0);
if (movie.available()) {
movie.read();

int[] depth = kinect.getRawDepth();

for (int x = 0; x < kinect.width; x++) {
for (int y = 0; y < kinect.height; y++) {
int offset = x + y * kinect.width;
int d = depth[offset];

if (d > minThresh && d < maxThresh) {
movie.speed(10.0);
} else {
movie.speed(1.0);
}
}
}
image(movie, 0, 0);
}
}

#2

You need to fix the code. You can add three back ticks ``` before and after your code above (you can edit the post, just click on the pencil icon). You should also check previous posts
posted in the Processing Foundation’s forum.

Also, if you cross-post your question, it is better to provide links so to avoid duplicate efforts: https://discourse.processing.org/t/kinect-and-processing-3-thesis-project/10683

Kf