Opencv aruco localisation - GigaFlopsis/rc_car_ros GitHub Wiki
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python2.7-dev python3.5-dev
sudo apt-get install ros-${ROS_DISTRO}-usb-cam
sudo apt-get install ros-${ROS_DISTRO}-vision-opencv
-
Downloan the last version Opencv from here (normal work is 3.4.1 ver.)
-
Unpack opencv*.zip (* means version of opencv)
-
Compile opencv
cd ~/opencv-*
mkdir build
cd build
cmake ..
compile Opencv with the following parameters:
WITH_GSTREAMER ON
WITH_GTK OFF
WITH_OPENGL ON
You can setup this parameters through > ccmake ..
make
sudo make install
Use this is example: http://wiki.ros.org/camera_calibration
- Run camera:
In usb usb_cam package for usb camera,to change resolution open usb_cam-test.launch.
Adjust:
image_width
image_height
pixel_format (I found for myself that mjpeg fastest format)
roslaunch usb_cam usb_cam-test.launch
- Start camera calibrator:
rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.035 image:=/usb_cam/image_raw camera:=/usb_cam
where --square= chessboard square size in meters. --size= chessboard size as NxM, counting interior corners (e.g. a standard chessboard is 7x7)
- After calibration, specify the path to .yaml with camera parameters in the file usb_cam/launch/usb_cam-test.launch
<param name="camera_info_url" value="file:///camera_param.yaml" />
Download and install:
aruco_eye
- In Aruco_eye_ros you need to change params in
launch files:
- aruco_eye/aruco_eye_ros/launch/aruco_eye_ros_detector.launch
- aruco_eye/aruco_eye_ros/launch/aruco_eye_ros_display.launch
<param name="image_topic_name" value="/usb_cam/image_raw" />
<param name="camera_info_topic_name" value="/usb_cam/camera_info" />
- In aruco_eye/aruco_eye_ros/config/arUcoList.xml adjust size of markers in meters.
<arucoMarker>
<id>2</id>
<size>0.253</size>
</arucoMarker>
- Now open three terminals and launch in this sequence
roslaunch usb_cam usb_cam-test.launch # Launches usb_cam topics
roslaunch aruco_eye_ros aruco_eye_ros_detector.launch # Launches aruco_detectors topics and publish pose of makers in topics
roslaunch aruco_eye_ros aruco_eye_ros_display.launch # Launches graphical visualization for coordinate frames in window