Bind PCL, OpenNi2 in DLL using Visual Studio 2012

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Bind PCL, OpenNi2 in DLL using Visual Studio 2012

PCLKinfuUser
This post has NOT been accepted by the mailing list yet.
Hi all,

I try to to bind the PCL in a Dynamic Link Library. Specially I want to use the Kinfu functionallity and wrap it.

I use Visual Studio 2012 (yes I got it to compile PCL for it), OpenNI2, Unicode and x64. I already started the Kinfu_App example appplication and it worked fine, without any problems (btw nice job!). For that I had to change some code in the App from OpenNI to OpenNI2.

But when I try to use the Kinfu functionality in my DLL i got really in trouble. So I don't get really far. First i try to link, include, bind everything from the Kinfu_app example. So got it more or less, had some problems at the beginning with the PCL_APIEXPORTS Makro but when I removed it, it started to compile.

But no I stuck really hard. Always Iam using OpenNI2, Visual Studio shows me some Memory Leaks after closing the MFC-Application (also when I just include some headers without any class initializations) which links to the Dll. Ignoring the Memory Leaks I try to call the OpenNI2_Grapper or DeviceManager. Always when they get Initialized I got some pcl::IOException. The exception just say that at some memory position was going something wrong. Not really helpfull. I have a bit the feeling that OpenNi2 can't find the driver for the Kinect.

My question is now if somebody has experience by using PCL/Kinfu/OpenNi2 in a Dynamic Link Library? Is it possible to us it in a DLL (think it should)? Or has somebody an idea where the error maybe come from?

Thanks for help if somthing is not clear please ask!

mg
Reply | Threaded
Open this post in threaded view
|

Re: Bind PCL, OpenNi2 in DLL using Visual Studio 2012

mg
Hello PCLKinfuUser,

Would you mind sharing some details about how you got the kinfu_app to run with OpenNI2? I am interested in doing the same thing, but it isn't clear how to deal with the openni_wrapper. I am using something close to PCL version 1.8.0.

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: Bind PCL, OpenNi2 in DLL using Visual Studio 2012

kwaegel
Administrator
Can you post the error log? It's hard to debug things from just the description.

There's a good chance it's just OpenNI2 not finding the drivers folder. It's kind of picky about that and rarely gives helpful errors.

I've been using OpenNI with kinfu for a while now, though I can't remember if I used DLLs or not. I haven't submitted a patch yet because it is not interchangeable with the OpenNI 1.x grabber.
mg
Reply | Threaded
Open this post in threaded view
|

Re: Bind PCL, OpenNi2 in DLL using Visual Studio 2012

mg
Thanks for your reply; however, with more understanding of the code I was able to get it working. In kinfu_app.cpp, I just had to add some header files:

#include <pcl/io/image.h>
#include <pcl/io/image_rgb24.h>
#include <pcl/io/image_yuv422.h>
#include <pcl/io/image_depth.h>
#include <pcl/io/image_ir.h>

Then replace "openni_wrapper" with "pcl::io". Also replaced OpenNIGrabber with OpenNI2Grabber.