1、安装usb_cam功能包
sudo apt-get install ros-melodic-usb-cam
2、启动摄像头
roslaunch usb_cam usb_cam-test.launch
报错如下:
解决方法:sudo apt-get install ros-noetic-image-view
3、rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.024 image:=/usb_cam/image_raw camera:=/usb_cam
会报出如下错误:
The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
根据提示需要重新安装:
sudo apt-get install libgtk2.0-dev pkg-config
在自己的opencv源码里面进入到build文件夹里,执行如下:
sudo cmake ..
sudo make
sudo make install
4、在执行第3步就会打开display的界面,然后拿标定版进行上下左右移动,根据提示保存相应的文件