install libfreenect2 on ubuntu 16.04

the install method has been listed in https://github.com/OpenKinect/libfreenect2

 

 

 

After installation, the test project is listed below:

 

CMakeList.txt

 

cmake_minimum_required(VERSION 2.8)



project(TestLibfreenect2)
add_executable(${PROJECT_NAME} "main.cpp")

find_package(freenect2 REQUIRED)


target_link_libraries(${PROJECT_NAME} ${freenect2_LIBRARIES})


main.cpp

 

 

 

#include <libfreenect2/libfreenect2.hpp>
//#include <libfreenect2/frame_listener_impl.h>
//#include <libfreenect2/registration.h>
//#include <libfreenect2/packet_pipeline.h>
//#include <libfreenect2/logger.h>

#include <iostream>

libfreenect2::Freenect2 freenect2;
libfreenect2::Freenect2Device *dev = 0;
libfreenect2::PacketPipeline *pipeline = 0;

int main()
{
    std::string serial;
    if(freenect2.enumerateDevices() == 0)
    {
      std::cout << "no device connected!" << std::endl;
      return -1;
    }
    if (serial == "")
    {
      serial = freenect2.getDefaultDeviceSerialNumber();
      std::cout << serial;
    }
    return 0;
}

 

 

 

 

the output:

 

[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 14 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @4:8 with serial 016240151047
[Info] [Freenect2Impl] found 1 devices
016240151047

 

 

 

 

 

However, I have been troubled by a problem for a long time. When I run /home/seamanj/libfreenect2/build/bin/Protonect, there was no 4 subwindows poping out and showed some errors like:

 

libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[Error] [VaapiRgbPacketProcessorImpl] vaInitialize(display, &major_ver, &minor_ver): unknown libva error

 

 

 

 

 

however, when I used vainfo command, the libva worked normally like:

 

libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.3)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG4Simple            :	VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    :	VAEntrypointVLD
      VAProfileH264Baseline           :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD

 

 

 

 

 

 Finally, I used cmake-gui and figured out the reason which was lacking of libglfw3.

sudo apt-get install libglfw3 libglfw3-dev

 

When I installed this lib and build again, after I run Protonect the windows came out.


 

update on 1.11.2018

please don't forget to copy

/libfreenect2/platform/linux/udev/90-kinect2.rules

to

 /etc/udev/rules.d

to get permission

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值