# webcam_retrieval **Repository Path**: weibin93/webcam_retrieval ## Basic Information - **Project Name**: webcam_retrieval - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-18 - **Last Updated**: 2024-03-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: edu ## README # README ## Description This package functions as a ROS node, facilitating the publication of images from the PC webcam for camera calibration tutorials. ## Environment - Python=3.8.10 - ROS Noetic ## Setup - Clone this repo into your workspace (say, `~/catkin_webcam_ws/src`) - Build the package by running `catkin build` under `~/catkin_webcam_ws` - Source the package by running `source ~/catkin_webcam_ws/devel/setup.bash` - Print `check-108.pdf` under the `checkboard` directory ## Usage **Terminal #1:** ``` roscore ``` **Terminal #2:** ```shell roslaunch webcam_retrieval start_webcam.launch ``` **Terminal #3:** ``` rviz ``` ![](https://foruda.gitee.com/images/1710746739684179814/31d6b132_5365632.png) Note that you need to change "Image Topic" to `/image_view/image_raw` in Rviz to see the camera readings. **Terminal #4:** ```shell rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/image_view/image_raw ``` ![](https://foruda.gitee.com/images/1710746756391846298/01ceee36_5365632.png) In order to get a good calibration you will need to move the checkerboard around in the camera frame such that: - checkerboard on the camera's left, right, top and bottom of field of view - X bar - left/right in field of view - Y bar - top/bottom in field of view - Size bar - toward/away and tilt from the camera - checkerboard filling the whole field of view - checkerboard tilted to the left, right, top and bottom (Skew) At each step, hold the checkerboard still until the image is highlighted in the calibration window. As you move the checkerboard around you will see three bars on the calibration sidebar increase in length. When the "CALIBRATE" button lights, you have enough data for calibration and can click "CALIBRATE" to see the results. Calibration can take about a minute. The windows might be greyed out but just wait, it is working. At the end of calibration process, you will see the results in the terminal as follows. ![](https://foruda.gitee.com/images/1710746734250624875/31a982cd_5365632.png) Click "SAVE" to save the results (in form of a zip file), including the intrinsic matrix and all the images captured for the camera calibration. ## Known issues - **Cannot read or open camera.** Open the terminal and type `ls /dev/video*` to list available serial ports for webcams connected to your system. Use the command `ffplay /dev/video0` with different available video IDs to identify the working webcam. Replace the number in `cv2.VideoCapture(0)` with the correct ID in the `webcam_node.py` file. ## References - [How to calibrate a monocular camera](http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration)