Cannot include OpenNI2 in PCL project

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

Cannot include OpenNI2 in PCL project

Mr.Giskard
Greetings,

I have recently compiled and installed PCL 1.8 from source on a Raspberry Pi
3 running Rasbian Jessie OS.

I now want to compile a project that will grab a point cloud from a Depth
Camera like the Kinect. To this end I've found an OpenNI2 package for
Rasbian containing the compiled libraries and include files.

I am not experienced in the creation of CMakeFiles so I am using a
CMakeLists file found in the official PCL tutorials as a basis to experiment
upon:

/cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(cloud_viewer)

find_package(PCL 1.2 REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable (cloud_viewer cloud_viewer.cpp)
target_link_libraries (cloud_viewer ${PCL_LIBRARIES})/

When I run cmake I get errors relating to OPENNI2:

/-- Could NOT find OpenNI2 (missing:  OPENNI2_LIBRARIES
OPENNI2_INCLUDE_DIRS)
** WARNING ** io features related to openni2 will be disabled/

I am guessing this is because when I compiled PCL from source I did not have
OpenNI2 installed and so it got left out from some kind of configuration
setup. I have searched the net and found a suggestion to add the explicit
paths to the CMakeLists file like so:

/include_directories("/usr/local/src/OpenNI-Linux-Arm-2.2/Include")
link_directories("/usr/local/src/OpenNI-Linux-Arm-2.2/Redist")
/

but this does not work - I get exactly the same errors. Can anyone help me
link the OpenNI2 libraries and files to the CMakeLists file?

Kind Regards,

Savvas



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Cannot include OpenNI2 in PCL project

Stephen McDowell
My understanding of your order of events:

1. Compile PCL for Raspberry Pi.
2. Compile OpenNI2 for Raspberry Pi.
3. For some project Proj, get an application to build with PCL and OpenNI2.

If so, the order is wrong.  You need to compile and install PCL using OpenNI2.  If I remember correctly you have been doing this all using cross compiling, in which case it might be a little more complicated than “just compile PCL with OpenNI2”.

Either way, dig around the PCL CMakeLists.txt searching for OpenNI2.  If that PCL_ADD_GRABBER call doesn’t find OpenNI2, it won’t incorporate support for it.  One file to look at is


You could just hack that file so that it uses the hard-coded paths to wherever your actual OpenNI2 installation is.

If I understand correctly, you are getting errors at step (3) because you didn’t compile OpenNI2 support with PCL.  Once you do, things should work.

One final thing to keep an eye on is there is a difference between OpenNI and OpenNI2.  IIRC the Kinect for Xbox 360 you should be using OpenNI (not v2).  But basically if you need OpenNI2, just make sure that if you are following this tutorial:


you are using the right “grabber” class.

OpenNI: #include <pcl/io/openni_grabber.h>
OpenNI2: #include <pcl/io/openni2_grabber.h>

If you aren’t sure, since you need to recompile PCL anyway, I’d say it’d be worth the effort to make sure both the OpenNI and OpenNI2 grabbers are compiled / installed.  That way you can just make small updates to the code instead of having to recompile again :)

And corresponding updates to the code using the grabber object.

Hope that helps some.

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Cannot include OpenNI2 in PCL project

Mr.Giskard
Oh I see.

I will recompile PCL after making changes to the findopenni file then

Regarding your tip on Kinekt, I guess openni2 isn't backwards compatible with openni then?

 I am indeed considering using the oroginal Kinekt but I thought the most recent version of openni would cover all devices.

Thanks for the help

On Mon, 23 Apr 2018 00:25 Stephen McDowell, <[hidden email]> wrote:
My understanding of your order of events:

1. Compile PCL for Raspberry Pi.
2. Compile OpenNI2 for Raspberry Pi.
3. For some project Proj, get an application to build with PCL and OpenNI2.

If so, the order is wrong.  You need to compile and install PCL using OpenNI2.  If I remember correctly you have been doing this all using cross compiling, in which case it might be a little more complicated than “just compile PCL with OpenNI2”.

Either way, dig around the PCL CMakeLists.txt searching for OpenNI2.  If that PCL_ADD_GRABBER call doesn’t find OpenNI2, it won’t incorporate support for it.  One file to look at is


You could just hack that file so that it uses the hard-coded paths to wherever your actual OpenNI2 installation is.

If I understand correctly, you are getting errors at step (3) because you didn’t compile OpenNI2 support with PCL.  Once you do, things should work.

One final thing to keep an eye on is there is a difference between OpenNI and OpenNI2.  IIRC the Kinect for Xbox 360 you should be using OpenNI (not v2).  But basically if you need OpenNI2, just make sure that if you are following this tutorial:


you are using the right “grabber” class.

OpenNI: #include <pcl/io/openni_grabber.h>
OpenNI2: #include <pcl/io/openni2_grabber.h>

If you aren’t sure, since you need to recompile PCL anyway, I’d say it’d be worth the effort to make sure both the OpenNI and OpenNI2 grabbers are compiled / installed.  That way you can just make small updates to the code instead of having to recompile again :)

And corresponding updates to the code using the grabber object.

Hope that helps some.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Cannot include OpenNI2 in PCL project

Stephen McDowell


Regarding your tip on Kinekt, I guess openni2 isn't backwards compatible with openni then?

 I am indeed considering using the oroginal Kinekt but I thought the most recent version of openni would cover all devices.

Unfortunately I don’t know the differences too well.


That company is the reason OpenNI2 is still kicking.  They make their own sensor, but I’d be willing to bet that OpenNI2 supports the Kinect v1.  Libfreenect has support for it:


Which would lead me to believe that OpenNI2 is able to recognize / startup a Kinect v1.  But that may not be true.

Maybe there is a sample executable that came with your installation of OpenNI2 that you can run with your Kinect 360 plugged in?  If so, see if it works, it may be all you need :)

All I know is that the history of OpenNI is confusing (to me), but it’s aim is toward general support of many different camera models (I believe).  So chances are, since the Kinect 360 is still widely in use, you’ll be good to go with OpenNI2!

I brought up OpenNI v1 because they are different grabber classes / headers.  But installing OpenNI v1 shouldn’t be exceptionally difficult for Raspberry Pi since you got v2 working (?)




_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Cannot include OpenNI2 in PCL project

Mr.Giskard
I'll probably get openni 1 on the pi as well just to be safe and try both.

Thanks again for the helpful reply

On Mon, 23 Apr 2018 00:47 Stephen McDowell, <[hidden email]> wrote:


Regarding your tip on Kinekt, I guess openni2 isn't backwards compatible with openni then?

 I am indeed considering using the oroginal Kinekt but I thought the most recent version of openni would cover all devices.

Unfortunately I don’t know the differences too well.


That company is the reason OpenNI2 is still kicking.  They make their own sensor, but I’d be willing to bet that OpenNI2 supports the Kinect v1.  Libfreenect has support for it:


Which would lead me to believe that OpenNI2 is able to recognize / startup a Kinect v1.  But that may not be true.

Maybe there is a sample executable that came with your installation of OpenNI2 that you can run with your Kinect 360 plugged in?  If so, see if it works, it may be all you need :)

All I know is that the history of OpenNI is confusing (to me), but it’s aim is toward general support of many different camera models (I believe).  So chances are, since the Kinect 360 is still widely in use, you’ll be good to go with OpenNI2!

I brought up OpenNI v1 because they are different grabber classes / headers.  But installing OpenNI v1 shouldn’t be exceptionally difficult for Raspberry Pi since you got v2 working (?)



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users