Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
35738bca
Commit
35738bca
authored
Jan 31, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samples: remove orphan documentation snippet: SBM_Sample.cpp
parent
a75840d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
70 deletions
+0
-70
SBM_Sample.cpp
samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp
+0
-70
No files found.
samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp
deleted
100644 → 0
View file @
a75840d1
/**
* @file SBM_Sample
* @brief Get a disparity map of two images
* @author A. Huaman
*/
#include <iostream>
#include "opencv2/calib3d.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
using
namespace
cv
;
const
char
*
windowDisparity
=
"Disparity"
;
void
readme
();
/**
* @function main
* @brief Main function
*/
int
main
()
{
readme
();
//-- 1. Read the images
Mat
imgLeft
=
imread
(
"../data/rubberwhale1.png"
,
IMREAD_GRAYSCALE
);
Mat
imgRight
=
imread
(
"../data/rubberwhale2.png"
,
IMREAD_GRAYSCALE
);
//-- And create the image in which we will save our disparities
Mat
imgDisparity16S
=
Mat
(
imgLeft
.
rows
,
imgLeft
.
cols
,
CV_16S
);
Mat
imgDisparity8U
=
Mat
(
imgLeft
.
rows
,
imgLeft
.
cols
,
CV_8UC1
);
if
(
imgLeft
.
empty
()
||
imgRight
.
empty
()
)
{
std
::
cout
<<
" --(!) Error reading images "
<<
std
::
endl
;
return
-
1
;
}
//-- 2. Call the constructor for StereoBM
int
ndisparities
=
16
*
5
;
/**< Range of disparity */
int
SADWindowSize
=
21
;
/**< Size of the block window. Must be odd */
Ptr
<
StereoBM
>
sbm
=
StereoBM
::
create
(
ndisparities
,
SADWindowSize
);
//-- 3. Calculate the disparity image
sbm
->
compute
(
imgLeft
,
imgRight
,
imgDisparity16S
);
//-- Check its extreme values
double
minVal
;
double
maxVal
;
minMaxLoc
(
imgDisparity16S
,
&
minVal
,
&
maxVal
);
printf
(
"Min disp: %f Max value: %f
\n
"
,
minVal
,
maxVal
);
//-- 4. Display it as a CV_8UC1 image
imgDisparity16S
.
convertTo
(
imgDisparity8U
,
CV_8UC1
,
255
/
(
maxVal
-
minVal
));
namedWindow
(
windowDisparity
,
WINDOW_NORMAL
);
imshow
(
windowDisparity
,
imgDisparity8U
);
//-- 5. Save the image
imwrite
(
"SBM_sample.png"
,
imgDisparity16S
);
waitKey
(
0
);
return
0
;
}
/**
* @function readme
*/
void
readme
()
{
std
::
cout
<<
" Usage: ./SBMSample <imgLeft> <imgRight>"
<<
std
::
endl
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment