在笔记本上安装CUDA8 & ZED Stereo Camera

ZED双目摄像头其实买到手的只是2个摄像头硬件,需要配合GPU才能运行使用SDK,记经过多次失败,成功在笔记本上运行了ZED的Demo。官方的安装步骤如下:

  • Make sure the latest USB 3.0 drivers are installed.
  • Install CUDA 8 and latest NVIDIA drivers.
  • [Linux] Compile and install OpenCV 3.1, more information here.
  • Run the ZED SDK setup tool to install the ZED driver, tools and samples.

    比较麻烦的是CUDA8的安装,另外在wiki上有详细的版本要求,支持Ubuntu16和CUDA8也是最近才有的事。

    1. 安装CUDA8

    目标系统是Ubuntu16-64bit,经过多次尝试,只有deb安装方式可行,其他的方式没有成功过。注意:最好是新系统安装,如果以前安装过NIVIDA笔记本显卡的驱动就要先卸载,安装CUDA时会自动安装相应的驱动,更方便可靠。首先是下载相应的deb文件,然后是参考安装手册安装deb文件:

    第一步命令补全自己下载的deb文件名称,第三步添加路径时可以在home文件夹隐藏文件.bashrc中添加下列语句(“Ctrl+H可以显示隐藏文件”),直接修改即可,需要在文件最后添加的语句,然后重启一下

    <span style="font-size:14px;">$ export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
    $ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}</span>

    之后就是按照第4步编译一个例子,看能不能运行,如果可以,表示CUDA的环境安装好了。


    2. 安装OpenCV3.1

    OpenCV官网下载源码,一定要是opencv3.1的,先修改源码的一个BUG:opencv3中有个模块在CUDA8.0中被抛弃了,编译会不通过,下载源码后,需要在opencv / modules / cudalegacy / src / graphcuts.cpp 中修改:(也就是在红色部分添加 || (CUDART_VERSION >=8000)    

    编译方法:

    先更新系统,安装依赖项:

    <span style="font-size:14px;">sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install build-essential 
    sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
    </span>

    然后解压下载的opencv文件,进入目录后编译并安装:

    <span style="font-size:14px;">cmake .
    sudo make -j4
    sudo make install
    </span>

    最后是构建路径:

    <span style="font-size:14px;">sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'  
    sudo ldconfig</span>

    编译opencv自带的samples:

    <span style="font-size:14px;">cd  xxxxxxxxx(你的opencv文件目录)/samples/
    sudo cmake .
    sudo make -j4
    </span>


    使用人脸检测测试一下安装的opencv,进入上述samples文件夹下的cpp文件夹:

    <span style="font-size:14px;">cd xxxxxxxxx/cpp/
    ./cpp-example-facedetect faces.jpg</span>

    成功安装,opencv!


    3. 安装ZED driver

    这部分很简单,下载对应的SDK,安装即可。ROS里面有ZED的wrapper:https://github.com/stereolabs/zed-ros-wrapper,安装方法见:http://wiki.ros.org/zed-ros-wrapper

    需要注意的是:安装包文件件的名字必须与节点一致(比如文件名字改成zed_wrapper),launch文件的参数列表如下:

    ParameterDescriptionValue
    svo_fileSVO filenamepath to an SVO file
    resolutionZED Camera resolution'0': HD2K
    __'1': HD1080
    __'2': HD720
    __'3': VGA
    qualityDisparity Map quality'0': NONE
    __'1': PERFORMANCE
    __'2': MEDIUM
    __'3': QUALITY
    sensing_modeDepth sensing mode'0': FILL
    __'1': STANDARD
    openni_depth_modeConvert depth to 16bit in millimeters'0': 32bit float meters
    __'1': 16bit uchar millimeters
    zed_idZED Camera ID, ignore if SVO file givenint, default '0'
    gpu_idGPU device ID, define which CUDA device will handle the computationint, default '-1' (best device found)
    frame_rateRate at which images are publishedint
    rgb_topicTopic to which rgb==default==left images are publishedstring
    rgb_cam_info_topicTopic to which rgb==default==left camera info are publishedstring
    rgb_frame_idID specified in the rgb==default==left image message headerstring
    left_topicTopic to which left images are publishedstring
    left_cam_info_topicTopic to which left camera info are publishedstring
    left_frame_idID specified in the left image message headerstring
    right_topicTopic to which right images are publishedstring
    right_cam_info_topicTopic to which right camera info are publishedstring
    right_frame_idID specified in the right image message headerstring
    depth_topicTopic to which depth map images are publishedstring
    depth_cam_info_topicTopic to which depth camera info are publishedstring
    depth_frame_idID specified in the depth image message headerstring
    point_cloud_topicTopic to which point clouds are publishedstring
    cloud_frame_idID specified in the point cloud message headerstring
    odometry_topicTopic to which odometry is publishedstring
    odometry_frame_idID specified in the odometry message headerstring
    odometry_transform_frame_idName of the transformation following the odometrystring

    最后一个ZED深度图效果图:

    
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值