I have setup my kinect camera and now I want to track the wrists (or torso, or head for that matter). I see that I can draw the skeleton. But i would like to get the actual position vectors of these joints, because I want to calculate the speed.
i am new to OS x and wanted to copy my processing sketches (from ubuntu) to my new mac. But I run into an error when i try to use GSvideo, see below. The sketch did run fine when i copied from windows to ubuntu.
EDIT: OK sorry, need to install the library again for osx
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: Unable to load library 'gstreamer-0.10': dlopen(libgstreamer-0.10.dylib, 9): image not found
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:163)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:236)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:379)
at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:48)
at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:45)
at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42)
at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39)
at org.gstreamer.Gst.<clinit>(Gst.java:59)
at codeanticode.gsvideo.GSVideo.initImpl(GSVideo.java:129)
at codeanticode.gsvideo.GSVideo.init(GSVideo.java:86)
at codeanticode.gsvideo.GSMovie.<init>(GSMovie.java:92)
at codeanticode.gsvideo.GSMovie.<init>(GSMovie.java:69)
at Motion_Recorder_mac.setNextMovie(Motion_Recorder_mac.java:351)
at Motion_Recorder_mac.setup(Motion_Recorder_mac.java:152)
at processing.core.PApplet.handleDraw(PApplet.java:1608)
EDIT: set framerate to be the same as the framereate of the movie and playback is much smoother. No freezes anymore :0
Hi all,
My sketch picks a random video from a set of about 60 movies. All movies are 1024 x 768 px, .avi format. Movies take about 3 seconds
I declare a movie by
GSMovie movie
Then the movie object is instantiated in the function setNextMovie():
movie = new GSMovie(this, "test_movie.avi");
I start the movie by calling:
movie.play()
then i stop the movie by calling:
movie.stop()
Then i call setNextMovie again which assigns "movie" to a new movie.
The filename is kept test_movie for, well, testing purposes.
. When i run the sketch everything is fine. After playing a few movies (i.e. 15 to 20) the sketch becomes unresponsive.
I still get respons from my controlP5 buttons, but the video remains frozen, and choosing setnextMovie() and START movie does not yield any effect.
Is this a common issue? What is the best video format for GSvideo?
I could make the movies smaller, but i want to be sure that it would solve the issue.
I post my code hereunder, its large, i know but it is working. Please download the sample movie from
here, and put it in your data folder inside the sketch folder.
Running the sketch, and choosing START movie, STOP movie, SETUP NEXT movie should freeze the sketch after a while.
I guess my working memory is filling up after some movies, i might have to destroy the movie objects?
i try to write an Pvector array to text file. My code works when i use PrintWriter. SInce PrintWriter doesn't have the ability to append data to files (not built in though), i decided to use FileWriter. My code trows an IO exception.
i just started off with my master thesis in human computer interaction. I want to investigate how people change their movements / gestures over time when they play motion sense enabled games, like wii-sports.
Since i encountered some time and programming skill constraints i think its better if i get an open source game and modify it to my needs.
Does anybody know some simple open source games, preferably which use the accelerometer?
A friend of mine pointed me to the fact that you can create processing sketches in Eclipse. I tried it a little but didnt get anything to work, i should try harder yes.
Now i wonder whats the advantage of using eclipse? As i understand most people use it? Or are there other editors?
my sketch should draw a graph, but cannot exceed a certain area. So when the max width is reached the graph should shift to the left.
PVector[] my_array = new PVector[100];
int val;
int j;
void setup() {
frameRate(1);
size(400,400);
//initialize some values
for (int i = 0; i < my_array.length; i++) {
my_array[i] = new PVector();
my_array[i].x = i;
my_array[i].y = i*2;
}
// printArray(my_array);
//
// shiftAndAdd(my_array, 10);
// printArray(my_array);
//
// shiftAndAdd(my_array, 999);
// printArray(my_array);
}
void draw(){
background(0);
stroke(255);
val = int(random (100,120));
my_array = shiftAndAdd(my_array, val);
for(int i = 0; i < my_array.length; i++){
point(my_array[i].x,my_array[i].y);
}
}
// shift all the values to the left, and set the new value at the end
PVector[] shiftAndAdd(PVector a[], int val){
int a_length = a.length;
System.arraycopy(a, 1, a, 0, a_length-1);
for(int i = 0; i < a.length; i++){
a[i].x = i;
}
printArray(a);
a[a_length-1].y = val;
return a;
}
// function to print array values in a row
void printArray(PVector a[]) {
for (int i = 0; i < a.length; i++) {
print("x: " + a[i].x + " y: " + a[i].y + ", ");
}
println("\n----");
}
the random value val should be added to the array form which the line is drawn. for some reason this does not happen... The graph shifts, but without the las added item...
Does processing not provide a array.pop() / push() function?
i want to store values coming from the motion sensor of my phone in an array and draw a graph of points based on this array.
When the length of the array reaches a certain value (800 in my case) i want to shift all values 1 position to the left and add a new value at position 799.
A new graph should be drawn based on this.
To conclude: if the graph reaches the end of the square the graph should move to the left. For some reason this doesnt happen with my code... i'm left with some flickering stars :(
import peasy.*;
import shapes3d.utils.*;
import shapes3d.animation.*;
import shapes3d.*;
import controlP5.*;
import rwmidi.*;
import processing.opengl.*;
import oscP5.*;
import netP5.*;
NetAddress myRemoteLocation;
OscP5 oscP5;
Graph myGraph;
//global rotation parameters
float rx, ry, rz;
void setup() {
smooth();
size(900, 500, OPENGL);
background(0);
lights();
oscP5 = new OscP5(this, 12000);
myRemoteLocation = new NetAddress("192.168.1.17", 12000);
myGraph = new Graph(100,100,800,200,-10,10);
}
void draw() {
rx = random(-10,10);
myGraph.storePoints();
myGraph.display();
if (frameCount > 799){
myGraph.movePoints();
}
}
class Graph {
//fields
int xPos, yPos, wd, ht, rgL, rgH, c;
PVector[] pointArray = new PVector[800];
//constructor
Graph(int _xPos, int _yPos, int _wd, int _ht, int _rgL, int _rgH ) { //xpos, ypos, width, height, min_point, max_point
i am writing a sort of game in which an airplane (user controlled) should leave a trailing path. This path is made up from a bezTube.
As it is now i record the xyz positions of the plane in a PVector array. The shapes3D lib has a function to create bezier tubes. This function takes the Pvector array as its input and creates the tube.
My problem is that the sketch slow, very slow. This is because i let the beziertube be created every loop of the draw function. It should be faster if i could expand the length of the tube in each loop. There does not seem to be a function for that however...
Any ideas how speed things up?
thanks!
my code:
void draw() {
lights();
background(0);
//display all floaters
for (int i=0; i < 1; i++) {
vlotSet[i].display();
}
//record path of floater
myPath.recordPath();
//display path of floater
myPath.display(this);
}
class Path {
//variables
Bezier3D form;
BezTube buis;
PVector[] vectorArray = new PVector[10000];
int i = 0;
//constructor
Path() {
//initialize vector array
for (int x = 0; x < vectorArray.length; x++) {
vectorArray[x] = new PVector(vlotSet[0].getXpos(), vlotSet[0].getYpos(), vlotSet[0].getZpos());
}
}
//methods
void recordPath() { //here i store the path
if (frameCount % 10 == 1) { //not every loop
vectorArray[i].x = vlotSet[0].getXpos();
vectorArray[i].y = vlotSet[0].getYpos();
vectorArray[i].z = vlotSet[0].getZpos();
i++;
}
}
PVector[] getPath() {
return vectorArray;
}
void display(PApplet applet) {
form = new Bezier3D(vectorArray, 1000);
buis = new BezTube(applet, form, 5, 500, 16);//Bezier3D bez, float rad, int nbrSlices, int nbrSegments
I am having troubles with the controlP5 lib. I want to write a class which contains my GUI. Creating a controlp5 object from within my own class works.
clicking a button should trigger the method controlEvent (ControlEvent theEvent). Now that i have rewritten the whole thing that it fits in the interfaceBuilder class, the method does not seem to be called anymore...
I am quite new to object oriented programming so an help in the right direction is greatly appreciated!!
I am using the controlP5 library to create a user interface. Since i try to train myself in writing nicely structured OO code i would like to instantiate the controlP5 class from y own interfaceBuilder class as following:
I would like to control ableton with my android phone (e.g. use the accelometer and stuff).
i did manage to send midi messages to channels in ableton. But i would also like to use the "learn" function of ableton (i.e. select MIDI map and move a controller knob -> that knob is now assigned to virtual knob in ableton).
I understand that i can use processing to send a controller change message to my KORG nano Kontrol, which can pass the message on to ableton.
But is there a way to kick the midi controller out of the equation and replace it with a virtual controller (so that i can more or less use the same code ;))