Sign in to follow this  

OpenCV, Freenect & OGRE libraries incompatible?

Recommended Posts


has anybody already successfully combined Freenect, OpenCV and OGRE?

I'm trying to add some 3D visualization features to a Freenect/OpenCV based application. The app itself works like a charm without OGRE. It also works with OGRE unless I load the "RenderSystem_GL" plugin. After successfully loading the plugin a [i]memcpy[/i] crashes that works without "RenderSystem_GL" loaded.

As my application also uses pthreads, this sounds to me like some sort of synchronization issue.

I'd appreciate any kind of help.



//edit: alright. It seems indeed to be a synchronization issue. The crashing memcpys are called in the rgb- and depth-data callback called by Freenect like this:
freenect_set_depth_callback(f_dev, depth_cb); // where depth_cb...
freenect_set_video_callback(f_dev, rgb_cb); // ... and rgb_cb are the corresponding callback functions
freenect_set_video_format(f_dev, FREENECT_VIDEO_RGB);

freenect_start_depth(f_dev); // here freenect starts to call the mentioned callbacks whenever image data arrives from the Kinect RGB or IR cameras

Synchronization using mutexes doesn't seem to work. I lock two of them before I initialize OGRE and unlock them after the initialization. I also lock the corresponding mutex before the memcpy of the depth- respectively the rgb-data callback gets called and unlock it afterwards.

If I have understood correctly, pthread_mutex_lock should block as long as another thread has a lock on the same mutex, right? Why are the memcpys called then, although the corresponding mutexes are locked by another thread? Ah, just to mention: they are declared as [color="#0000ff"][i]volatile[/i][/color].

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this