Need help in using the C++ Wrapper for OpenCV

487 views
Skip to first unread message

Aron

unread,
Mar 8, 2011, 4:41:27 PM3/8/11
to OpenKinect
Hello!

I'm a beginner in programming the KINECT yet, but I'd like to work on
it, so I'm asking your help in the following:

I've installed the freenect driver for Win 7 platform, and it works
correctly with KINECT, I tried the glview.exe, glcplview.exe demos
etc. - these works!
I used the instructions from here: http://openkinect.org/wiki/Getting_Started

But now I don't know, what is next, if I'd like to get depth image,
and use it with OpenCV in cpp.
My final target is to trace my hand's movement in a way.

So could anyone give me help how to create an own project (VS2010)
with the CPP wrapper, and use it?
http://openkinect.org/wiki/C%2B%2B_Wrapper

And how do I know, which function are available for me? - or is there
any API?

Sorry for the silly questions, I really hope somebody will helps me.

Waiting for your answers!

All the best,
Aron

Omar

unread,
Mar 8, 2011, 5:25:44 PM3/8/11
to OpenKinect
Hi Aron!
I have the same problem!!!!

I'm using Ubuntu Lucid, I installed freenect driver, working perfect.
But I don't know how to use the opencv wrapper using CodeBlocks; when
I try to build the project, i got :

undefined reference to 'freenect_sync_get_rgb_cv'
undefined reference to 'freenect_sync_get_tgb_cv'

I tried to put libfreenect.h on the same folder. but nothing.

Can you please help us??

thanks you guys.
Omar.

On 8 Mar, 22:41, Aron <varga...@gmail.com> wrote:
> Hello!
>
> I'm a beginner in programming the KINECT yet, but I'd like to work on
> it, so I'm asking your help in the following:
>
> I've installed the freenect driver for Win 7 platform, and it works
> correctly with KINECT, I tried the glview.exe, glcplview.exe demos
> etc. - these works!
> I used the instructions from here:http://openkinect.org/wiki/Getting_Started
>
> But now I don't know, what is next, if I'd like to get depth image,
> and use it with OpenCV in cpp.
> My final target is to trace my hand's movement in a way.
>
> So could anyone give me help how to create an own project (VS2010)
> with the CPP wrapper, and use it?http://openkinect.org/wiki/C%2B%2B_Wrapper

Aron

unread,
Mar 10, 2011, 5:23:24 PM3/10/11
to OpenKinect
Hi Everyone!

Nobody can help us?
How can I build the C++OpenCvExample.cpp for example?

Still waiting for your answers!

Thanks,
Aron

Jorge

unread,
Mar 10, 2011, 5:48:28 PM3/10/11
to OpenKinect
Hi all:

I think your problem is in the code, it is an old example. Try like
Nomad says in this post. Remember answer if it works or not.

http://groups.google.com/group/openkinect/browse_thread/thread/9fe11465bb09a9d9

Greetings, Jorge.

nomad

unread,
Mar 11, 2011, 4:47:02 AM3/11/11
to OpenKinect
hi
i am not working with win 7 or with the newest release,
but, if you want your stuff to compile
the basics for c++ and linux and a old release
have a look at:
https://github.com/freenomad/freenomad_vision/downloads/
there are some code (c++ and c) with opencv and opengl
if you working with the newest release and or win7 then you have base
for your work
make a port and DIY.
regards nomad

On Mar 8, 10:41 pm, Aron <varga...@gmail.com> wrote:
> Hello!
>
> I'm a beginner in programming the KINECT yet, but I'd like to work on
> it, so I'm asking your help in the following:
>
> I've installed the freenect driver for Win 7 platform, and it works
> correctly with KINECT, I tried the glview.exe, glcplview.exe demos
> etc. - these works!
> I used the instructions from here:http://openkinect.org/wiki/Getting_Started
>
> But now I don't know, what is next, if I'd like to get depth image,
> and use it with OpenCV in cpp.
> My final target is to trace my hand's movement in a way.
>
> So could anyone give me help how to create an own project (VS2010)
> with the CPP wrapper, and use it?http://openkinect.org/wiki/C%2B%2B_Wrapper

Omar

unread,
Mar 13, 2011, 2:22:45 PM3/13/11
to OpenKinect
Thank you for the answers guys,

Hi nomad, I tried some of your exemples like cvGlview_002.cpp and when
I try to compile it with CodeBlocks it gives me this:

../cvGlView_002.cpp|275|error: ‘Freenect::Freenect’ is not a template|
../cvGlView_002.cpp|276|error: no matching function for call to
‘Freenect::Freenect::createDevice(int)’|
||=== Build finished: 2 errors, 0 warnings ===|


I seached and i didn't find the solution!!!
I'm new and this is my first try with openCv and Kinect, so please
help me; I just need to understand how OpenCV+Libfreenect+Codeblocks
can work together with some examples if it's possible.

Thanks you so much for your help.

nomad

unread,
Mar 14, 2011, 4:23:13 AM3/14/11
to OpenKinect
hi,
sorry but i working not with code::blocks
ev. useful: compile c++
g++ -fPIC -g -Wall -I/usr/include/GL -I/usr/local/include/opencv -I/
usr/X121R6/include -I../libusb/libusb/libusb-1.0 -I/usr/local/include/
libfreenect -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml -I/
usr/X11R6/include -L/usr/X11R6/lib -o glview_002 glview_002.cpp -
lfreenect -lglui -lglut -lGLU -lGL
or with gcc:
cc -fPIC -g -Wall glview_002.c -o glview_002 -I/usr/X121R6/include -
I../libusb/libusb/libusb-1.0 -I/usr/local/include/libfreenect -L/usr/
X121R6/lib -L/usr/local/lib64 -lfreenect -lglut -lGLU -lGL -lm
regards nomad

nomad

unread,
Mar 14, 2011, 4:38:47 AM3/14/11
to OpenKinect
hi
excuse this 2. posting:
i have testing cvGlView_002.cpp with compile:

g++ -fPIC -g -Wall -I/usr/include/GL -I/usr/local/include/opencv -I/
usr/X121R6/include -I../libusb/libusb/libusb-1.0 -I/usr/local/include/
libfreenect -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml -I/
usr/X11R6/include -L/usr/X11R6/lib -o cvGlView_002 cvGlView_002.cpp -
lfreenect -lglui -lglut -lGLU -lGL

compile ok with some warnings
regards nomad

Omar

unread,
Mar 14, 2011, 5:09:28 AM3/14/11
to OpenKinect
Ok Thank you nomad for the quick answer,

I'm gonna try it as soon as I get home, because i'm at the university
right now!

Thank you again nomad!

Omar

unread,
Mar 14, 2011, 2:01:18 PM3/14/11
to OpenKinect
Ok here I'm,

I just tried your method as it is posted,
I get this errors about :

cvGlView_002.cpp:275: error: ‘Freenect::Freenect’ is not a template

so I found in this post :
http://groups.google.com/group/openkinect/browse_thread/thread/a906915615f98397/acfe7cca9955a111?#acfe7cca9955a111

that I have to change:

Freenect::Freenect<MyFreenectDevice> freenect;
MyFreenectDevice& device = freenect.createDevice(0);

into:

Freenect::Freenect freenect;
MyFreenectDevice& device = freenect.createDevice<MyFreenectDevice>(0);

And this worked just lovely!!!

than i had to install the glut and glui packages that missed,

and now everything WORK 100%

THANK YOU SO MUCH NOMAD!!!!
a really Great job!!!!
greating from Italy!

Omar.

On 14 Mar, 09:38, nomad <stevenm...@bluewin.ch> wrote:

Saúl

unread,
Mar 15, 2011, 4:58:54 PM3/15/11
to OpenKinect
You can compile it using pkg-config, like that:
gcc `pkg-config --cflags --libs opencv libfreenect` -lfreenect_cv -o
cvdemo cvdemo.c

or the "long" way:
gcc -I/usr/local/include/libfreenect -I/usr/local/include/opencv -I/
usr/include/libusb-1.0 -L/usr/local/lib64 -L/usr/local/lib -lml -
lcvaux -lhighgui -lcv -lcxcore -lfreenect -lusb-1.0 -lfreenect_cv -o
cvdemo cvdemo.c


On 8 mar, 15:41, Aron <varga...@gmail.com> wrote:
> Hello!
>
> I'm a beginner in programming the KINECT yet, but I'd like to work on
> it, so I'm asking your help in the following:
>
> I've installed the freenect driver for Win 7 platform, and it works
> correctly with KINECT, I tried the glview.exe, glcplview.exe demos
> etc. - these works!
> I used the instructions from here:http://openkinect.org/wiki/Getting_Started
>
> But now I don't know, what is next, if I'd like to get depth image,
> and use it with OpenCV in cpp.
> My final target is to trace my hand's movement in a way.
>
> So could anyone give me help how to create an own project (VS2010)
> with the CPP wrapper, and use it?http://openkinect.org/wiki/C%2B%2B_Wrapper

Omar

unread,
Mar 16, 2011, 5:08:11 AM3/16/11
to OpenKinect
Yes Indeed, that worked for me to.

nomad

unread,
Mar 16, 2011, 6:46:52 AM3/16/11
to OpenKinect
hi
thanks for the roses...:-)
and good work
regards nomad

On Mar 14, 7:01 pm, Omar <omark...@gmail.com> wrote:
> Ok here I'm,
>
> I just tried your method as it is posted,
> I get this errors about :
>
> cvGlView_002.cpp:275: error: ‘Freenect::Freenect’ is not a template
>
> so I found in this post :http://groups.google.com/group/openkinect/browse_thread/thread/a90691...
Message has been deleted

Aron

unread,
Mar 23, 2011, 8:09:44 AM3/23/11
to OpenKinect
Hi!

I've linked and included all that you told, changed the specific line,
that Omar said, and it builded correctly (cvGlView_002.cpp). That's
fine, thank you guys, but when I'm trying to run the program, it
throws me a runtime error:
"Unhandled exception at 0x5b053379 (freenect.dll) in myKINECT.exe:
0x0000005:
Access violation writing location 0xcdcdcdd5."

This is under Win7, with VS2010. (OpenCV 2.1)
Have you got an idea, how to solve this problem?

Waiting for your answer!

Thanks in advance,
Aron
Reply all
Reply to author
Forward
0 new messages