1 <!-- Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. -->
3 @defgroup nvx_sample_stereo_matching Stereo Matching Demo App
4 @brief Stereo Matching Demo user guide.
8 <a name=
"Introduction">
11 `nvx_demo_stereo_matching` is a simple stereo matching demo that uses
12 Semi-Global Matching algorithm to evaluate disparity. It performs color
13 conversion and downscaling prior to evaluating stereo
for better quality and
14 performance. The input images are expected to be undistorted and rectified.
16 The pipeline can be illustrated by the following diagram:
18 (left frame) (right frame)
20 [ScaleImage] (down) [ScaleImage] (down)
22 [ColorConvert] (to gray) [ColorConvert] (to gray)
24 +---------+ +----------+
28 [ConvertDepth] (to 8-bit)
36 In the second step, the demo converts the disparity image into color output
using the following pipeline:
40 +------------------+------------------+
42 [TableLookup] [TableLookup] [TableLookup]
44 (Red Channel) (Blue Channel) (Green Channel)
46 +------------------+------------------+
52 Color output is created
using linear conversion of disparity values from [0..ndisp) interval into the HSV color space,
53 where the smallest disparity (far objects) corresponds to [H=240, S=1, V=1] (blue color) and the
54 largest disparity (near objects) corresponds to [H=0, S=1, V=1] (red color).
55 The resulting HSV value is then converted to RGB color space
for visualization.
57 `nvx_demo_stereo_matching` is installed in the following directory:
59 /usr/share/visionworks/sources/demos/stereo_matching
61 For the steps to build sample applications, see the @ref nvx_samples_and_demos
65 ## Executing the Stereo Matching Demo ##
67 ./nvx_demo_stereo_matching [options]
69 ### Command Line Options ###
71 This topic provides a list of supported options and the values they consume.
73 #### \-s, \--source ####
74 - Parameter: [input URI]
75 - Description: Specifies the input URI. Video, image, or image sequence must contain both
76 channels in top-bottom layout.
79 - `--source=/path/to/image`
for image
80 - `--source=/path/to/video.avi`
for video
81 - `--source=/path/to/image_%04d_sequence.png`
for image sequence
83 @note On Vibrante V3Le, V4L platforms hardware accelerated video playback is supported
for H.264
84 elementary streams only.
86 @note The V4L platform has a permissions issue. If input data are an H.264 elementary stream, hardware decoder
87 is used and sample must be executed with super user permissions, i.e., with `sudo`.
89 #### \-c, \--config ####
90 - Parameter: [config file path]
91 - Description: Specifies the path to the configuration file.
93 The file contains the parameters of the stereo matching algorithm.
96 - Parameter: [integer value greater or equal to zero and less or equal to 256]
97 - Description: Minimum and maximum disparity values. Defaults are 0 and 64. Maximum disparity must be
102 - Parameter: [integer value greater than or equal to zero and less than or equal to 256]
103 - Description: Penalty parameters
for SGBM algorithm. The larger the values are, the smoother the disparity.
104 P1 is the penalty on the disparity change by plus or minus 1 between neighbor pixels; P2 - by more than 1.
105 The algorithm requires P2 > P1. Defaults are 8 and 109.
108 - Parameter: [odd integer greater than zero and less than or equal to 31]
109 - Description: The size of the SAD window. Default is 5.
112 - Parameter: [odd integer in range 15 to 95]
113 - Description: Truncation value
for pre-filtering algorithm. It first computes x-derivative at each pixel and clips
114 its value to [-bt_clip_value, bt_clip_value] interval. Default is 31.
117 - Parameter: [integer value greater than or equal to zero]
118 - Description: Maximum allowed difference (in integer pixel units) in the left-right disparity check.
121 - **uniqueness_ratio**
122 - Parameter: [integer value greater than or equal to zero and less than or equal to 100]
123 - Description: Margin in percents by which the best (minimum) computed cost function value must beat the second
124 best value to consider the found match correct.
127 - Parameter: [integer value in range 0 to 255]
128 - Description: Bit-mask for enabling any combination of 8 possible directions. The lowest bit corresponds to
129 "from-left-to-right" direction (
NVX_SCANLINE_LEFT_RIGHT enumeration value). The second lowest bit corresponds to
135 `./nvx_demo_stereo_matching --config=/path/to/config_file.ini`
137 - If the argument is omitted, the default config file will be used.
139 #### -h, \--help ####
140 - Description: Prints the help message.
142 ### Operational Keys ###
143 - Use `S` to
switch between displaying the original frame, disparity image, and color output.
144 - Use `Space` to pause/resume the demo.
145 - Use `ESC` to close the demo.
aggregate cost from left to right diagonally starting from the top.
aggregate cost from left to right horizontally.