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
17f7b12a
Commit
17f7b12a
authored
Jul 22, 2010
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable winSize for StereoBP_GPU
Fixed StereoBM_GPU kernel crash Textureness threshold added
parent
26c48596
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
13 deletions
+28
-13
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+7
-1
cuda_shared.hpp
modules/gpu/src/cuda/cuda_shared.hpp
+1
-1
stereobm.cu
modules/gpu/src/cuda/stereobm.cu
+0
-0
stereobm_gpu.cpp
modules/gpu/src/stereobm_gpu.cpp
+20
-11
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
17f7b12a
...
...
@@ -335,6 +335,7 @@ namespace cv
//! the full constructor taking the camera-specific preset, number of disparities and the SAD window size
//! ndisparities should be multiple of 8. SSD WindowsSize is fixed to 19 now
StereoBM_GPU
(
int
preset
,
int
ndisparities
=
DEFAULT_NDISP
,
int
winSize
=
DEFAULT_WINSZ
);
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair
//! Output disparity has CV_8U type.
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
...
...
@@ -350,9 +351,14 @@ namespace cv
int
ndisp
;
int
winSize
;
int
preset
;
// If avergeTexThreshold == 0 => post procesing is disabled
// If avergeTexThreshold != 0 then disparity is set 0 in each point (x,y) where for left image
// SumOfHorizontalGradiensInWindow(x, y, winSize) < (winSize * winSize) * avergeTexThreshold
// i.e. input left image is low textured.
float
avergeTexThreshold
;
private
:
GpuMat
minSSD
,
leBuf
,
riBuf
;
};
}
}
...
...
modules/gpu/src/cuda/cuda_shared.hpp
View file @
17f7b12a
...
...
@@ -80,7 +80,7 @@ namespace cv
static
inline
void
___cudaSafeCall
(
cudaError_t
err
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
)
{
if
(
cudaSuccess
!=
err
)
cv
::
gpu
::
error
(
cudaGetErrorString
(
err
),
__FILE__
,
__LINE__
,
func
);
cv
::
gpu
::
error
(
cudaGetErrorString
(
err
),
file
,
line
,
func
);
}
#endif
/* __OPENCV_CUDA_SHARED_HPP__ */
modules/gpu/src/cuda/stereobm.cu
View file @
17f7b12a
This diff is collapsed.
Click to expand it.
modules/gpu/src/stereobm_gpu.cpp
View file @
17f7b12a
...
...
@@ -48,12 +48,11 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA)
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
()
{
throw_nogpu
();
}
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
(
int
preset_
,
int
ndisparities_
)
{
throw_nogpu
();
}
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
(
int
,
int
,
int
)
{
throw_nogpu
();
}
bool
cv
::
gpu
::
StereoBM_GPU
::
checkIfGpuCallReasonable
()
{
throw_nogpu
();
return
false
;
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
CudaStream
&
stream
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
const
CudaStream
&
)
{
throw_nogpu
();
}
#else
/* !defined (HAVE_CUDA) */
...
...
@@ -61,17 +60,24 @@ namespace cv { namespace gpu
{
namespace
impl
{
extern
"C"
void
stereoBM_GPU
(
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
disp
,
int
max
disp
,
int
winsz
,
const
DevMem2D_
<
uint
>&
minSSD_buf
);
extern
"C"
void
stereoBM_GPU
(
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
disp
,
int
n
disp
,
int
winsz
,
const
DevMem2D_
<
uint
>&
minSSD_buf
);
extern
"C"
void
prefilter_xsobel
(
const
DevMem2D
&
input
,
const
DevMem2D
&
output
,
int
prefilterCap
=
31
);
extern
"C"
void
postfilter_textureness
(
const
DevMem2D
&
input
,
int
winsz
,
float
avergeTexThreshold
,
const
DevMem2D
&
disp
);
}
}}
const
float
defaultAvgTexThreshold
=
3
;
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
()
:
preset
(
BASIC_PRESET
),
ndisp
(
DEFAULT_NDISP
),
winSize
(
DEFAULT_WINSZ
)
{}
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
(
int
preset_
,
int
ndisparities_
,
int
winSize_
)
:
preset
(
preset_
),
ndisp
(
ndisparities_
),
winSize
(
winSize_
)
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
()
:
preset
(
BASIC_PRESET
),
ndisp
(
DEFAULT_NDISP
),
winSize
(
DEFAULT_WINSZ
),
avergeTexThreshold
(
defaultAvgTexThreshold
)
{}
cv
::
gpu
::
StereoBM_GPU
::
StereoBM_GPU
(
int
preset_
,
int
ndisparities_
,
int
winSize_
)
:
preset
(
preset_
),
ndisp
(
ndisparities_
),
winSize
(
winSize_
),
avergeTexThreshold
(
defaultAvgTexThreshold
)
{
const
int
max_supported_ndisp
=
1
<<
(
sizeof
(
unsigned
char
)
*
8
);
CV_Assert
(
0
<
ndisp
&&
ndisp
<=
max_supported_ndisp
);
CV_Assert
(
ndisp
%
8
==
0
);
CV_Assert
(
winSize
%
2
==
1
);
}
bool
cv
::
gpu
::
StereoBM_GPU
::
checkIfGpuCallReasonable
()
...
...
@@ -87,7 +93,7 @@ bool cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable()
if
(
major
>
1
||
numSM
>
16
)
return
true
;
return
false
;
}
...
...
@@ -102,19 +108,22 @@ void cv::gpu::StereoBM_GPU::operator() ( const GpuMat& left, const GpuMat& right
GpuMat
le_for_bm
=
left
;
GpuMat
ri_for_bm
=
right
;
if
(
preset
==
PREFILTER_XSOBEL
)
{
leBuf
.
create
(
left
.
size
(),
left
.
type
());
riBuf
.
create
(
right
.
size
(),
right
.
type
());
impl
::
prefilter_xsobel
(
left
,
leBuf
);
impl
::
prefilter_xsobel
(
right
,
riBuf
);
le_for_bm
=
leBuf
;
ri_for_bm
=
riBuf
;
}
impl
::
stereoBM_GPU
(
le_for_bm
,
ri_for_bm
,
disparity
,
ndisp
,
winSize
,
minSSD
);
impl
::
stereoBM_GPU
(
le_for_bm
,
ri_for_bm
,
disparity
,
ndisp
,
winSize
,
minSSD
);
if
(
avergeTexThreshold
)
impl
::
postfilter_textureness
(
le_for_bm
,
winSize
,
avergeTexThreshold
,
disparity
);
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
CudaStream
&
stream
)
...
...
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