OPENNI and OPENCV

3,164 views
Skip to first unread message

Faisal Mazhar

unread,
Jan 18, 2012, 12:54:31 PM1/18/12
to OpenNI
I want to use OPENCV for Kinect. But I don't have any idea how to do
that. I heard that it's possible if I configure OpenCV with OPENNI.
But before that I have to configure CMAKE so that it enables OPENNI.
How to enable OPENNI in CMAKE so that I can configure OPENCV with
OPENNI ?

Carlos Roberto

unread,
Jan 18, 2012, 1:42:45 PM1/18/12
to openn...@googlegroups.com
Hi,
When you download the OpenCV package you will get a CMakeLists.txt file where OPENNI is already configured and you can enable or disable its use.
Cheers.



--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.




--
Carlos Roberto, MSc
Software Eng. Consultant @ IBM
My Blog
My LinkedIn
follow me @ twitter
My YouTube videos

Faisal Mazhar

unread,
Jan 18, 2012, 2:40:14 PM1/18/12
to OpenNI
Thanks a lot Mr Carlos. But now I see that CMAKE can't find the PRIME
SENSOR MODULE. I have installed the prime sensor, but still cmake
can't find it. What could be the problem? Thanks it advance.

On Jan 18, 7:42 pm, Carlos Roberto <carlo...@gmail.com> wrote:
> Hi,
> When you download the OpenCV package you will get a CMakeLists.txt file
> where OPENNI is already configured and you can enable or disable its use.
> Cheers.
>
> On Wed, Jan 18, 2012 at 3:54 PM, Faisal Mazhar <faisalmodes...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > I want to use OPENCV for Kinect. But I don't have any idea how to do
> > that. I heard that it's possible if I configure OpenCV with OPENNI.
> > But before that I have to configure CMAKE so that it enables OPENNI.
> > How to enable OPENNI in CMAKE so that I can configure OPENCV with
> > OPENNI ?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "OpenNI" group.
> > To post to this group, send email to openn...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > openni-dev+...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/openni-dev?hl=en.
>
> --
> Carlos Roberto, MSc
> Software Eng. Consultant @ IBM
> My Blog <http://kinect-i.blogspot.com/>
> My LinkedIn <http://br.linkedin.com/pub/carlos-lacerda-msc/5/964/378>
> follow me @ twitter <http://twitter.com/#%21/ze_tech>
> My YouTube videos <http://youtu.be/_x6m8IXMTXI>

Gabriele

unread,
Jan 18, 2012, 4:39:35 PM1/18/12
to OpenNI

Carlos Roberto

unread,
Jan 18, 2012, 4:50:02 PM1/18/12
to openn...@googlegroups.com
If cmake can not find OPENNI, then you can type the path manually for each variable in cmake regarding to OPENNI.
Cheers.


--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.




--
Carlos Roberto, MSc
Software Eng. Consultant @ IBM
My Blog

Andol

unread,
Jan 19, 2012, 4:36:10 AM1/19/12
to OpenNI
using cmake-gui, tick the option of OPENNI, it works

On Jan 18, 9:50 pm, Carlos Roberto <carlo...@gmail.com> wrote:
> If cmake can not find OPENNI, then you can type the path manually for each
> variable in cmake regarding to OPENNI.
> Cheers.
>
> On Wed, Jan 18, 2012 at 7:39 PM, Gabriele <gabriele.fontanar...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Take a look here:
> >http://opencv.itseez.com/doc/user_guide/ug_highgui.html
>
> > ;)
>
> > On 18 Gen, 18:54, Faisal Mazhar <faisalmodes...@gmail.com> wrote:
> > > I want to use OPENCV for Kinect. But I don't have any idea how to do
> > > that. I heard that it's possible if I configure OpenCV with OPENNI.
> > > But before that I have to configure CMAKE so that it enables OPENNI.
> > > How to enable OPENNI in CMAKE so that I can configure OPENCV with
> > > OPENNI ?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "OpenNI" group.
> > To post to this group, send email to openn...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > openni-dev+...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/openni-dev?hl=en.
>
> --
> Carlos Roberto, MSc
> Software Eng. Consultant @ IBM

Faisal Mazhar

unread,
Jan 19, 2012, 4:08:15 PM1/19/12
to OpenNI
Thanks all of you for your clear answers. Cmake now shows that it does
configure OpenCV with OpenNI, as I can see in the cmakecache where the
directories for Xncore.dll files and the directory from prime sensor
is shown . But when I tried to capture video in OpenCv it doesn't seem
to work. For testing whether OpenCv is working properly I used one
sample c++ file kinect_maps.cpp from the following link

http://fossies.org/dox/OpenCV-2.3.1a/kinect__maps_8cpp.html

and I was told that if OpenCV is properly configured with
OpenNI it I should be able get image depth and other information. But
it only shows the following :


This program demonstrates usage of Kinect sensor.
The user gets some of the supported output images.

All supported output map types:
1.) Data given from depth generator
OPENNI_DEPTH_MAP - depth values in mm (CV_16UC1)
OPENNI_POINT_CLOUD_MAP - XYZ in meters (CV_32FC3)
OPENNI_DISPARITY_MAP - disparity in pixels (CV_8UC1)
OPENNI_DISPARITY_MAP_32F - disparity in pixels (CV_32FC1)
OPENNI_VALID_DEPTH_MASK - mask of valid pixels (not ocluded,
not shaded etc.) (CV_8UC1)
2.) Data given from RGB image generator
OPENNI_BGR_IMAGE - color image (CV_8UC3)
OPENNI_GRAY_IMAGE - gray image (CV_8UC1)

Kinect opening ...
done.
Can not open a capture object.
Press any key to continue . . .


This was supposed to show when video can't be captured from the
Kinect. My concern is if OpenCv was not properly configured with
OpenNI commands like "CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE"
shouldn't work, right?

OpenNI seems to working okay as the Demo applications like
SimpleViewer.net and UserTracker.net are working.
What can be the problem?
Thanks for the attention.

nathanlin

unread,
Jul 12, 2012, 2:02:53 PM7/12/12
to openn...@googlegroups.com
I am facing the same problem. Although I tried changing the Openni support option to ON and cmake .. in build, my OpenNi and Prime modules are still off. How to I specify the path? Do I replace ON with the new path (home/kinect/.....)?


On Wednesday, January 18, 2012 1:50:02 PM UTC-8, roberto wrote:
If cmake can not find OPENNI, then you can type the path manually for each variable in cmake regarding to OPENNI.
Cheers.


On Wed, Jan 18, 2012 at 7:39 PM, Gabriele <gabriele.fontanarosa@gmail.com> wrote:

On 18 Gen, 18:54, Faisal Mazhar <faisalmodes...@gmail.com> wrote:
> I want to use OPENCV for Kinect. But I don't have any idea how to do
> that. I heard that it's possible if I configure OpenCV with OPENNI.
> But before that I have to configure CMAKE so that it enables OPENNI.
> How to enable OPENNI in CMAKE so that I can configure OPENCV with
> OPENNI ?

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

David da Silva Pires

unread,
Jul 12, 2012, 4:34:52 PM7/12/12
to openn...@googlegroups.com
Hi, nathanlin.

No, you can't change the value of the variable WITH_OPENNI to a path, it only accepts boolean values, like "ON/OFF", "TRUE/FALSE" or "1/0" depending of cmake version and graphical interface, I think. I recommend the program cmake-gui, on package cmake-qt-gui, to deal with CMakeLists.txt.

The only thing you can do is set the variable WITH_OPENNI to ON. The, cmake will search for an OpenNI installation on your system. To see where cmake will search, take a look at the file <OpenCV_src_root>/cmake/OpenCVFindOpenNI.cmake, where OpenCV_src_root is the name of the folder where you decompressed OpenCV source code. If you are working on GNU/Linux, it seems that cmake will search for file XnCppWrapper.h on directories /usr/include/ni and /usr/include/openni. It will also search for the libraries libOpenNI.so and libXnCore.so on /usr/lib. Check if you have these files installed on these proper locations. If not, maybe your installation was not successfully completed.

Good luck.

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Erwin José Lopez Pulgarin

unread,
Jul 12, 2012, 8:17:47 PM7/12/12
to openn...@googlegroups.com
Hi

Maybe this can help, the instructions are very clear:
http://docs.opencv.org/doc/user_guide/ug_highgui.html

If you installation isn't in the default path, you can specify the paths.
Message has been deleted

nathanlin

unread,
Jul 16, 2012, 5:58:28 PM7/16/12
to openn...@googlegroups.com

nathanlin

unread,
Jul 16, 2012, 5:58:58 PM7/16/12
to openn...@googlegroups.com
I was able to turn on Openni and Nite modules using cmake gui, but when I run openni_capture or kinect_map, I still receive the error of "Can not open a capture object.", as shown below. What should I do?

Thanks,
Nathan


This program demonstrates usage of Kinect sensor.
The user gets some of the supported output images.

All supported output map types:
1.) Data given from depth generator
   OPENNI_DEPTH_MAP            - depth values in mm (CV_16UC1)
   OPENNI_POINT_CLOUD_MAP      - XYZ in meters (CV_32FC3)
   OPENNI_DISPARITY_MAP        - disparity in pixels (CV_8UC1)
   OPENNI_DISPARITY_MAP_32F    - disparity in pixels (CV_32FC1)
   OPENNI_VALID_DEPTH_MASK     - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1)
2.) Data given from RGB image generator
   OPENNI_BGR_IMAGE            - color image (CV_8UC3)
   OPENNI_GRAY_IMAGE           - gray image (CV_8UC1)

Kinect opening ...
done.
Can not open a capture object.

David da Silva Pires

unread,
Jul 18, 2012, 2:42:22 PM7/18/12
to openn...@googlegroups.com
Hi, nathalin.

Maybe this problem is caused by a kernel module that is loaded when you connect your Kinect to the USB port. On my system, as soon as I plug my Kinect, it is loaded a module called gspca_kinect. You can see if this also happens to you with the command "lsmod | grep gspca". Then, to remove this module, I do:

     $> sudo rmmod gspca_kinect

and everything works.

If I try to execute kinect_maps from OpenCV-2.3.1 without removing the cited module, I have the same output than you, but with one line added:

=========================================================
(...)

2.) Data given from RGB image generator
   OPENNI_BGR_IMAGE            - color image (CV_8UC3)
   OPENNI_GRAY_IMAGE           - gray image (CV_8UC1)

Device opening ...
CvCapture_OpenNI::CvCapture_OpenNI : Failed to create production tree: Failed to set USB interface!

done.
Can not open a capture object.
=========================================================

I hope this solution works for you too.

Good luck!

Muhammad Asad

unread,
Oct 30, 2012, 10:46:04 PM10/30/12
to openn...@googlegroups.com
Hi faisal,

Check out the detailed tutorial on how to configure OpenCV for Kinect using OpenNI at:
Compiling opencv with OpenNI

I wrote this tutorial a while ago when I faced the same problem as you are having.

I hope this helps

Pedro Silva

unread,
Oct 31, 2012, 4:08:30 AM10/31/12
to openn...@googlegroups.com
Hi, 

Take a look at www.viim.pt

It uses opencv and you have a package  with opencv for full installation. 

Regards,
Pedro Silva
R&D Manager
CoVii - Computer Vision Interaction
--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openni-dev/-/u7HBgs0i7_gJ.

To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages