• No results found

Opencv examples on Kinect

N/A
N/A
Protected

Academic year: 2021

Share "Opencv examples on Kinect"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

Opencv examples on Kinect

We are using Opencv to work on Kinect's RGB output. Cvdemo.c , an opencv example to run with kinect, available easily. We faced some issues in compiling it with gcc, so we used cmake and make

instead. Cmake and make commands are used to compile and execute source code on Linux.

Cmake is an open source software that configures your build parameters before compilation. In simple words, it just checks your system. It will generate the Makefile used later by make to buikd the example.

Open Terminal and access the build directory present in your source code. Write down cmake...

madiha-salafi@Black-Beauty:~/OpenKinect/build$ cmake ..

-- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc

-- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done -- Operating system is Linux

-- Got System Processor i686

-- libfreenect will be installed to /usr/local

(2)

-- Libraries will be installed to /usr/local/lib -- Found libusb-1.0:

-- - Includes: /usr/include

-- - Libraries: /usr/lib/libusb-1.0.so -- Check if the system is big endian -- Searching 16 bit integer

-- Looking for sys/types.h

-- Looking for sys/types.h - found -- Looking for stdint.h

-- Looking for stdint.h - found -- Looking for stddef.h

-- Looking for stddef.h - found -- Check size of unsigned short -- Check size of unsigned short - done -- Using unsigned short

-- Check if the system is big endian - little endian

-- Looking for include files CMAKE_HAVE_PTHREAD_H

-- Looking for include files CMAKE_HAVE_PTHREAD_H - found

-- Looking for pthread_create in pthreads

-- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread

-- Looking for pthread_create in pthread - found

-- Found Threads: TRUE

-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so

-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found -- Looking for gethostbyname

(3)

-- Looking for gethostbyname - found -- Looking for connect

-- Looking for connect - found -- Looking for remove

-- Looking for remove - found -- Looking for shmat

-- Looking for shmat - found

-- Looking for IceConnectionNumber in ICE

-- Looking for IceConnectionNumber in ICE - found -- Found X11: /usr/lib/libX11.so

-- Configuring done -- Generating done

-- Build files have been written to: /home/madiha-salafi/OpenKinect/build

Now the *.c examples for kinect are configured successfully. Write 'make' to start building the binaries:

madiha-salafi@Black-Beauty:~/OpenKinect/build$ make

Scanning dependencies of target freenect

[ 5%] Building C object src/CMakeFiles/freenect.dir/core.c.o [ 11%] Building C object src/CMakeFiles/freenect.dir/tilt.c.o [ 16%] Building C object src/CMakeFiles/freenect.dir/cameras.c.o [ 22%] Building C object src/CMakeFiles/freenect.dir/usb_libusb10.c.o Linking C shared library ../lib/libfreenect.so

(4)

Scanning dependencies of target freenectstatic

[ 27%] Building C object src/CMakeFiles/freenectstatic.dir/core.c.o [ 33%] Building C object src/CMakeFiles/freenectstatic.dir/tilt.c.o [ 38%] Building C object src/CMakeFiles/freenectstatic.dir/cameras.c.o [ 44%] Building C object src/CMakeFiles/freenectstatic.dir/usb_libusb10.c.o Linking C static library ../lib/libfreenect.a

[ 44%] Built target freenectstatic

Scanning dependencies of target freenect_sync

[ 50%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync.dir/libfreenect_sync.c.o Linking C shared library ../../lib/libfreenect_sync.so

[ 50%] Built target freenect_sync

Scanning dependencies of target glpclview

[ 55%] Building C object examples/CMakeFiles/glpclview.dir/glpclview.c.o Linking C executable ../bin/glpclview

[ 55%] Built target glpclview

Scanning dependencies of target glview

[ 61%] Building C object examples/CMakeFiles/glview.dir/glview.c.o /home/madiha-salafi/OpenKinect/examples/glview.c: In function ‘main’:

/home/madiha-salafi/OpenKinect/examples/glview.c:360: warning: control reaches end of non-void function

Linking C executable ../bin/glview [ 61%] Built target glview

Scanning dependencies of target tiltdemo

[ 66%] Building C object examples/CMakeFiles/tiltdemo.dir/tiltdemo.c.o Linking C executable ../bin/tiltdemo

[ 66%] Built target tiltdemo

(5)

[ 72%] Building C object fakenect/CMakeFiles/fakenect.dir/fakenect.c.o Linking C shared library ../lib/fakenect/libfreenect.so

[ 72%] Built target fakenect

Scanning dependencies of target record

[ 77%] Building C object fakenect/CMakeFiles/record.dir/record.c.o Linking C executable ../utils/record

[ 77%] Built target record

Scanning dependencies of target freenect_sync_static

[ 83%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync_static.dir/libfreenect_sync.c.o Linking C static library ../../lib/libfreenect_sync.a

[ 83%] Built target freenect_sync_static Scanning dependencies of target cppview

[ 88%] Building CXX object wrappers/cpp/CMakeFiles/cppview.dir/cppview.cpp.o

Linking CXX executable ../../bin/cppview [ 88%] Built target cppview

Scanning dependencies of target freenect_cv

[ 94%] Building C object wrappers/opencv/CMakeFiles/freenect_cv.dir/libfreenect_cv.c.o Linking C shared library ../../lib/libfreenect_cv.so

[ 94%] Built target freenect_cv

Scanning dependencies of target cvdemo

[100%] Building C object wrappers/opencv/CMakeFiles/cvdemo.dir/cvdemo.c.o

Linking C executable ../../bin/cvdemo [100%] Built target cvdemo

Now to start away with installation, use 'make install'. You have to be root to carry out this operation, so use sudo with it.

(6)

madiha-salafi@Black-Beauty:~/OpenKinect/build$ sudo make install

[sudo] password for madiha-salafi: [ 22%] Built target freenect

[ 44%] Built target freenectstatic [ 50%] Built target freenect_sync [ 55%] Built target glpclview [ 61%] Built target glview [ 66%] Built target tiltdemo [ 72%] Built target fakenect [ 77%] Built target record

[ 83%] Built target freenect_sync_static [ 88%] Built target cppview

[ 94%] Built target freenect_cv [100%] Built target cvdemo Install the project...

-- Install configuration: "" -- Installing: /usr/local/lib/libfreenect.so.0.0.1 -- Up-to-date: /usr/local/lib/libfreenect.so.0.0 -- Up-to-date: /usr/local/lib/libfreenect.so -- Installing: /usr/local/lib/libfreenect.a -- Up-to-date: /usr/local/include/libfreenect/libfreenect.h -- Installing: /usr/local/lib/pkgconfig/libfreenect.pc -- Installing: /usr/local/bin/glview

-- Removed runtime path from "/usr/local/bin/glview" -- Installing: /usr/local/bin/glpclview

(7)

-- Removed runtime path from "/usr/local/bin/glpclview" -- Installing: /usr/local/bin/tiltdemo

-- Removed runtime path from "/usr/local/bin/tiltdemo" -- Installing: /usr/local/lib/fakenect/libfreenect.so.0.0.1 -- Up-to-date: /usr/local/lib/fakenect/libfreenect.so.0.0 -- Up-to-date: /usr/local/lib/fakenect/libfreenect.so -- Installing: /usr/local/lib/libfreenect_sync.so.0.0.1 -- Up-to-date: /usr/local/lib/libfreenect_sync.so.0.0 -- Up-to-date: /usr/local/lib/libfreenect_sync.so

-- Removed runtime path from "/usr/local/lib/libfreenect_sync.so.0.0.1" -- Installing: /usr/local/lib/libfreenect_sync.a

-- Up-to-date: /usr/local/include/libfreenect/libfreenect_sync.h -- Up-to-date: /usr/local/include/libfreenect.hpp

-- Installing: /usr/local/bin/cppview

-- Removed runtime path from "/usr/local/bin/cppview" -- Installing: /usr/local/lib/libfreenect_cv.so.0.0.1 -- Installing: /usr/local/lib/libfreenect_cv.so.0.0 -- Installing: /usr/local/lib/libfreenect_cv.so

-- Removed runtime path from "/usr/local/lib/libfreenect_cv.so.0.0.1" -- Installing: /usr/local/include/libfreenect/libfreenect_cv.h

-- Installing: /usr/local/bin/cvdemo

-- Removed runtime path from "/usr/local/bin/cvdemo"

After getting through these steps smoothly.. we are ready to run cvdemo..

(8)

madiha-salafi@Black-Beauty:~/OpenKinect/build/bin$

madiha-salafi@Black-Beauty:~/OpenKinect/build/bin$ ./cvdemo

Error: Invalid index [0] Error: Kinect not connected?

Don't forget to plug in Kinect..!

madiha-salafi@Black-Beauty:~/OpenKinect/build/bin$ ./cvdemo

cvdemo shows both RGB and Depth videos.

To clean up later

References

Related documents