Install kinect V2 driver and camera calibration on ubuntu16.04

Official address of kinect V2 camera driver: https://github.com/OpenKinect/libfreenect2

Download libfreenect2

git clone https://github.com/OpenKinect/libfreenect2.git
cd libfreenect2

Install the compilation environment

Installation prerequisite environment

Compilation tool

sudo apt-get install build-essential cmake pkg-config

libusb

sudo apt-get install libusb-1.0-0-dev

TurboJPEG

sudo apt-get install libturbojpeg libjpeg-turbo8-dev

OpenGL

sudo apt-get install libglfw3-dev

The required dependencies are installed in a unified manner:

sudo apt-get install build-essential cmake pkg-config libusb-1.0-0-dev libturbojpeg libjpeg-turbo8-dev libglfw3-dev

#Install optional dependency
OpenCL

sudo apt-get install beignet-dev

MIRACLES

VAAPI

sudo apt-get install libva-dev libjpeg-dev

OpenNI2

sudo apt-get install libopenni2-dev

Compile configuration

Compile

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
make
make install
# -DCMAKE_INSTALL_PREFIX指定安装的路径

Set device access rules

sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/

debugging

./bin/Protonect

During debugging, check whether the camera usb is connected to 3.0

Calibration

1. Ros workspace construction

New workspace

2. Download and compile the kinect2 driver node

cd src
download source code

git clone https://github.com/code-iai/iai_kinect2.git

Dependencies needed to install kinect2

cd iai_kinect2
rosdep install -r --from-paths

Compile node

catkin_make

Test connection

#1. Open kinect2_bridge

roslaunch kinect2_bridge kinect2_bridge.launch

#2. Start kinect2_viewer

rosrun kinect2_viewer kinect2_viewer

You can view the configurable parameters through rosrun kinect2_viewer kinect2_viewer --help.

#Kinect2 Drive Communication
# View the data released by the kinect2 driver and the output result of the
rostopic list
is as follows:

/kinect2/bond
/kinect2/hd/camera_info
/kinect2/hd/image_color
/kinect2/hd/image_color/compressed
/kinect2/hd/image_color_rect
/kinect2/hd/image_color_rect/compressed
/kinect2/hd/image_depth_rect
/kinect2/hd/image_depth_rect/compressed
/kinect2/hd/image_mono
/kinect2/hd/image_mono/compressed
/kinect2/hd/image_mono_rect
/kinect2/hd/image_mono_rect/compressed
/kinect2/hd/points
/kinect2/qhd/camera_info
/kinect2/qhd/image_color
/kinect2/qhd/image_color/compressed
/kinect2/qhd/image_color_rect
/kinect2/qhd/image_color_rect/compressed
/kinect2/qhd/image_depth_rect
/kinect2/qhd/image_depth_rect/compressed
/kinect2/qhd/image_mono
/kinect2/qhd/image_mono/compressed
/kinect2/qhd/image_mono_rect
/kinect2/qhd/image_mono_rect/compressed
/kinect2/qhd/points
/kinect2/sd/camera_info
/kinect2/sd/image_color_rect
/kinect2/sd/image_color_rect/compressed
/kinect2/sd/image_depth
/kinect2/sd/image_depth/compressed
/kinect2/sd/image_depth_rect
/kinect2/sd/image_depth_rect/compressed
/kinect2/sd/image_ir
/kinect2/sd/image_ir/compressed
/kinect2/sd/image_ir_rect
/kinect2/sd/image_ir_rect/compressed
/kinect2/sd/points

The kinect2 camera transmits data through topics. A lot of topic information will be found in topic.
hd, qhd, sd stand for resolution respectively.

#Debug display camera image

rosrun image_view image_view image:=/kinect2/hd/image_color


#Camera calibration start kinect2_brige

rosrun kinect2_bridge kinect2_bridge _fps_limit:=2

_fps_limit:=2 Set the camera to sample at 2 frames per second.

View the startup log at startup to get the device sequence.

Create sampled folders

mkdir ~/kinect_cal_data
cd ~/kinect_cal_data

Color image sampling

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 record color
chess6x9x0.02: chess为标定板,格式为widthxheightxsize.

width为标定板宽度方向的标定点个数。

height为标定板高度方向的标定点个数。

size为标定方格的宽度,单位为米。

彩图标定

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 calibrate color
红外图采样

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 record ir
红外图标定

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 calibrate ir
同步采样

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 record sync
同步标定

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 calibrate sync
深度标定

rosrun kinect2_calibration kinect2_calibration chess6x9x0.02 calibrate depth

Store the calibration results in the specified directory

Go to the kinect2_bridge/data directory

roscd kinect2_bridge/data
mkdir 设备串口名称

The device serial port name is printed in the log when kinect2_bridge starts

Copy the calibration result configuration file

cp ~/kinect_cal_data/calib_color.yaml .
cp ~/kinect_cal_data/calib_depth.yaml .
cp ~/kinect_cal_data/calib_ir.yaml .
cp ~/kinect_cal_data/calib_pose.yaml .

Guess you like

Origin blog.csdn.net/hongge_smile/article/details/107852854