Stereo
Objective
The objective of the Stereo lab is:
- to examine area-based matching costs: Sum of Absolute Differences (SAD) (and Normalized Cross Correlation (NCC))
- to build shiftable windows, and
- to build coarse-to-fine strategy using your upsampling method
Software
- To access the necessary files for this lab, see directory
/eecs/home/wildes/prism/4422/Lab4_Stereo
- You need to modify your code from Image Representation lab.
- To compile
sampleOpenCV.c
on CentOS,
- Link the library location in the binary
% setenv LD_RUN_PATH /cs/local/lib64
- Compile the
sampleOpenCV.c
% g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` sampleOpenCV.c
- To compile sampleOpenCV.c on Ubuntu,
% g++ `pkg-config opencv --cflags` sampleOpenCV.c `pkg-config opencv --libs`
Task
- Modify your code,
sampleOpenCV.c
from the Image Representation lab, such that it takes two images, LeftImageFileName
and RightImageFileName
, to visualize a disparity map:
% ./a.out LeftImageFileName RightImageFileName [options]
The disparity map can be computed by matching local regions between the left and right images using SAD (or NCC) on the Laplacian pyramid.
- When
./a.out LeftImageFileName RightImageFileName
is executed,
- 'ESC'-- exits the program
- 'l' -- displays left pyramid
- 'r' -- displays right pyramid
- Further modify your code such that it can accept the following optional arguments,
- [Options]
- -x [val] : local search range, by default
"1"
- -l [val] : pyramid levels, by default
"1"
. NOTE: If you have more than one pyramid level, you should visualize all the levels.
- -w [val] : aggregate window size, by default
"5"
- -maxDisp [val] : maximum disparity, by default
"64"
- -G : use the Gaussian pyramid instead of the Laplacian pyramid
- -sw : use shiftable windows
Example output using a Laplacian pyramid with 5 levels and a 20×20 window.
Example output using a Laplacian pyramid with 5 levels and a 5×5 window.