Skip to content
Daniel Laguna edited this page Apr 17, 2017 · 10 revisions

Usage

You can run with -h argument all the software to see the manual.

All the arguments surrounded by <arg> are obligatory, and all surrounded by [arg] are optionals.

VideoCapture

This program will capture video from two cameras. It can be used to calculate the framerate of the two cameras.

./VideoCapture <camera0> <camera1> [-s <width> <height>] [-t]

-t    Starts the test mode. The program runs 100 loops and calculates the framerate.

calibrateStereo

This program is used to calibrate a stereo system using a calibration pattern. A chessboard is used on this software as a calibration pattern.

When the software is running, it asks you some questions:

  1. Number of horizontal corners of the pattern
  2. Number of vertical corners of the pattern
  3. Size of the squares of the pattern (on millimeters)
  4. Number of snapshots to take
  5. Number of the left and right camera

In order to calibrate the stereo system, you must show the pattern to the cameras. Then the cameras detect the corners of the pattern. With the space bar, you can save the snapshot of the corners and continue the process.

Detecting the corners

When all the snapshots are captured, the software calculates the intrinsics and extrinsic parameters of the stereo system and save a calibration file in the same folder. The file name depends on the resolution of the cameras, and is called stereo_calib_resolutionHeight.yml

The results of the calibration are the following:

At the start, we have a unrectified couple of images

Unrectified

As a result, we obtain a rectified couple of images

Rectified

./stereo_calb [width] [height] [-a]

-a    Activate the automatic mode for take snapshots of the corners (Not recommended to use)

stereo_matchBM

This software uses the BM (Block Matching) algorithm for calculate the disparity map. Then with the disparity map the software calculates the differents blobs in the scene and estimates the distance to them.

In order to run this software, you need a calibration file. Calibration must be the first operation to do before running this software.

When you have the calibration file, the program be able to rectify the pictures captured by the stereo system and calculate the disparity map.

Scene Disparity

Then a threshold function is applied to the disparity map and the blobs and distance are calculated.

Threshold Blob

When the software is running, you can press r key to stop or resume the recording, m key to change between positive and negatives values for min. disparity parameter, change the method to calculate the distances pressing d or take a snapshot of the windows pressing the space bar.

./stereo_matchBM [camera0] [camera1] [-l image0 image1] [-c calib_file] [-d 1|2] [--test] [-h]

-l    Instead of using the cameras, you can use two rectified images
-c    Path to a calibration file
-d    Distance method. 1 average, 2 trend. Default 1
--test   Activate the test mode and calculate the framerate

stereo_matchSGBM

The same software than stereo_matchBM but it uses the SGBM (Semi Global Block Matching) algorithm to calculate the disparity maps.

./stereo_matchSGBM [camera0] [camera1] [-l image0 image1] [-c calib_file] [-d 1|2] [--test] [-h]

-l    Instead of using the cameras, you can use two rectified images
-c    Path to a calibration file
-d    Distance method. 1 average, 2 trend. Default 1
--test   Activate the test mode and calculate the framerate

stereo_matchBM_threads

The same software than stereo_matchBM but this is parallelized. The idea is that frames taken by cameras and the resulting disparity map were made at the same time.

For that, we have a buffer at the middle that will be filling with images that are going to be processed.

Pipeline

./stereo_matchBM_threads [camera0] [camera1] [-l image0 image1] [-c calib_file] [-t n][-d 1|2] [--test] [-h]

-t    Number of tasks that the program run
-l    Instead of using the cameras, you can use two rectified images
-c    Path to a calibration file
-d    Distance method. 1 average, 2 trend. Default 1
--test   Activate the test mode and calculate the framerate

SurfObjectDetector

This software recognizes differents known objects of the scene using the SURF algorithm.

./surf_object_detector [-bw] [-c camera] [-m min_matches]

-bw   Switch to the black and white mode
-m    Select the min number of matches for draw the detected object

SURF

Clone this wiki locally