Problems with Open Kinect and Open CV
in
Contributed Library Questions
•
2 years ago
Hello there everyone!
I was playing around with the Open Kinect library, and it was awesome, really makes it easy to do background substraction. However, I was trying to combine the depth information from the Kinect and pass it to OpenCV using the following code
import org.openkinect.*;
import org.openkinect.processing.*;
import hypermedia.video.*;
OpenCV opencv;
Kinect kinect;
void setup() {
size (640, 480);
opencv = new OpenCV(this);
kinect = new Kinect (this);
kinect.start();
kinect.enableDepth(true);
}
void draw() {
PImage depth = kinect.getDepthImage();
image(depth, 0, 0);
opencv.copy(depth);
opencv.threshold(180);
Blob[] blobs = opencv.blobs(10, width*height/2, 100, true);
fill (255,0,0);
for (int i = 0; i < blobs.length; i++) {
beginShape();
for (int j = 0 ; j < blobs[i].points.length; j++) {
vertex (blobs [i].points[j].x, blobs[i].points[j].y);
}
endShape(CLOSE);
}
}
void stop() {
kinect.quit();
super.stop();
}
, but I always get an error message like this
OpenCV ERROR: Null pointer (NULL array pointer is passed)
Invalid memory access of location 00000000 eip=22c384bf
in function cvGetMat, ../../src/cxcore/cxarray.cpp(2781)
Terminating the application...
I couldn't see mistakes in my code, as I've presumably followed required steps for using both library.
Can anybody point out where my mistake could be?
Thank you very much guys :)
1