Jump to content
  • Advertisement
Sign in to follow this  

OpenCV, Freenect & OGRE libraries incompatible?

This topic is 2563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 memcpy 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"]volatile.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!