roymacdonald / kinectToTexturedOBJ

class to save the data from the kinect as a textured OBJ file.
24 stars 12 forks source link

crash if kinect not plugged in #5

Open heaversm opened 12 years ago

heaversm commented 12 years ago

Hi - I have developed a pretty good workflow for recording an ONI from processing, then exporting that ONI to OBJ files. I even configured it to export at only a certain Z depth range. The only issue I'm running in to at this point is that, if the Kinect is not plugged in, the program crashes.

I get an error in openframeworks > graphics > ofPixels.cpp :

Thread 1: EXC_BAD_ACCESS (code=2, address=0x10)

In this code:

template<typename PixelType>
bool ofPixels_<PixelType>::isAllocated() const{
    return bAllocated;
}

It's strange - in the visual editor, if the kinect is plugged in, when I load the ONI, the depthImage displays properly, looping through the recorded sequence, but the RGB image is actually a live feed from the kinect. If I disconnect the kinect and run the program and select an ONI, the depth image shows up, but the RGB image is completely absent from the editor (and exporting causes the above crash. Any ideas on how to go about solving this one?

heaversm commented 12 years ago

Just a note - I made a workaround that solves the crash issue by disabling the RGB image entirely. In testApp.cpp, commenting out the addImageGenerator() line, and changing setRegister() to setRegister(false), then removing the getImagePixels parameter for the exportDepthToObj function call, I could export a pointcloud without having the kinect plugged in. But I'd like to get the ImageGenerator working properly for visualization purposes, even if it is not necessary for the rendered OBJ point cloud.

roymacdonald commented 12 years ago

Hi, my first guess is that your processing sketch is not saving the RGB data from the kinect. That would explain very much the problem. I'll update my app tomorrow so you can record and export directly from the same application. Try recording with the examples from ofxOpenNI.

cheers