Tag Archives: camera calibration

Computing Fundamental Matrix and Drawing Epipolar Lines for Stereo Vision Cameras in OpenCV

Following my other post, you can extract the equation for epipolar lines. Basically choosing one point in one image and using fundamental matrix, we will get a line in the other image:


RGBD PCL point cloud from Stereo vision with ROS and OpenCV

In my other tutorial, I showed you how to calibrate you stereo camera. After Calibration, we can get disparity map and  RGBD PCL point cloud from our stereo camera cool huh 🙂

1)Save the following text under “stereo_usb_cam_stream_publisher.launch

2) Then run the following node to publish both cameras and camera info (calibration matrix)

3) Run the following to rectify image and compute the disparity map:

Super important: If you have USB cam with some delays you should add the following “_approximate_sync:=true”

4) Let’s view everything:

Super important: If you have USB cam with some delays you should add the following “_approximate_sync:=True _queue_size:=10”

5) Running rqt graph should give you the following:

6) Run the to configure the matching algorithm parameter:

7) PCL pointcloud in RVIZ

How to use a calibrated camera in ROS

In my previous tutorial I showed you how to calibrate a camera with ROS. In this tutorial, I’m gonna show you how to rectify the images from coming from your camera.

First, open your text editor and paste the following text into it:

make the necessary changes and save it under usb_cam_stream_publisher.launch

Now run it:

Open another text document and paste the following into it:

save it under image_proc.launch. Now run it:

The codes are available on my Github


Calibrating a Monocular Camera with ROS

ROS use OpenCV for camera calibration but the format that it stores the data is different than OpenCV. Also, you need to know where to place the camera calibration files so ROS can find it and publish it.

1.First, you need to install usb cam package from ROS and uvcdynctrl to disable autofocus:

2.Open a terminal and run roscore:

3. Turn off the autofocus of your camera (if your camera supports autofocus):

check if your camera supports autofocus:

turn off the autofocus:

check if the autofocus is off:

4. Publish the data from your camera, for example, via use usb_cam:

5.Connect camera_calibratio to the node publishing camera images: (node and topic name should be adjusted: image:=/usb_cam/image_raw camera:=/usb_cam) and a checkerboard with 0.02517-meter squares:


6.After getting enough images click on the calibrate and then save. If you click on the commit button if will copy calibration data into:


7. Fix the calibration URL. Put the YAML file in the