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
12dc52c2
Commit
12dc52c2
authored
Jul 27, 2010
by
Andrey Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented asynchronous call for StereoBM()
parent
dc0f3139
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
25 deletions
+33
-25
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+1
-1
stereobm.cu
modules/gpu/src/cuda/stereobm.cu
+0
-0
precomp.hpp
modules/gpu/src/precomp.hpp
+6
-5
stereobm_gpu.cpp
modules/gpu/src/stereobm_gpu.cpp
+26
-19
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
12dc52c2
...
...
@@ -349,7 +349,7 @@ namespace cv
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
);
//! Acync version
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
CudaStream
&
stream
);
void
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
CudaStream
&
stream
);
//! Some heuristics that tries to estmate
// if current GPU will be faster then CPU in this algorithm.
...
...
modules/gpu/src/cuda/stereobm.cu
View file @
12dc52c2
This diff is collapsed.
Click to expand it.
modules/gpu/src/precomp.hpp
View file @
12dc52c2
...
...
@@ -46,25 +46,26 @@
#pragma warning( disable: 4251 4710 4711 4514 4996 )
#endif
#ifdef HAVE_CONFIG_H
#include <cvconfig.h>
#ifdef HAVE_CONFIG_H
#include <cvconfig.h>
#endif
#include <iostream>
#include <limits>
#include "opencv2/gpu/gpu.hpp"
#include "opencv2/gpu/stream_accessor.hpp"
#if defined(HAVE_CUDA)
#include "cuda_shared.hpp"
#include "cuda_runtime_api.h"
#include "cuda_runtime_api.h"
#else
/* defined(HAVE_CUDA) */
static
inline
void
throw_nogpu
()
{
CV_Error
(
CV_GpuNotFound
,
"The library is compilled with no GPU support"
);
}
#endif
/* defined(HAVE_CUDA) */
#endif
/* __OPENCV_PRECOMP_H__ */
#endif
/* __OPENCV_PRECOMP_H__ */
modules/gpu/src/stereobm_gpu.cpp
View file @
12dc52c2
...
...
@@ -56,25 +56,26 @@ void cv::gpu::StereoBM_GPU::operator() ( const GpuMat&, const GpuMat&, GpuMat&,
#else
/* !defined (HAVE_CUDA) */
namespace
cv
{
namespace
gpu
{
namespace
impl
namespace
cv
{
namespace
gpu
{
namespace
impl
{
extern
"C"
void
stereoBM_GPU
(
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
disp
,
int
ndisp
,
int
winsz
,
const
DevMem2D_
<
uint
>&
minSSD_buf
);
//extern "C" void stereoBM_GPU(const DevMem2D& left, const DevMem2D& right, const DevMem2D& disp, int ndisp, int winsz, const DevMem2D_<uint>& minSSD_buf);
extern
"C"
void
stereoBM_GPU
(
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
disp
,
int
ndisp
,
int
winsz
,
const
DevMem2D_
<
uint
>&
minSSD_buf
,
const
cudaStream_t
&
stream
);
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
()
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_
)
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
);
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
);
...
...
@@ -92,12 +93,12 @@ bool cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable()
int
numSM
=
getNumberOfSMs
(
device
);
if
(
major
>
1
||
numSM
>
16
)
return
true
;
return
true
;
return
false
;
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
)
void
stereo_gpu_operator
(
GpuMat
&
minSSD
,
GpuMat
&
leBuf
,
GpuMat
&
riBuf
,
int
preset
,
int
ndisp
,
int
winSize
,
float
avergeTexThreshold
,
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
cudaStream_t
&
stream
)
{
CV_DbgAssert
(
left
.
rows
==
right
.
rows
&&
left
.
cols
==
right
.
cols
);
CV_DbgAssert
(
left
.
type
()
==
CV_8UC1
);
...
...
@@ -109,26 +110,33 @@ 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
)
if
(
preset
==
StereoBM_GPU
::
PREFILTER_XSOBEL
)
{
leBuf
.
create
(
left
.
size
(),
left
.
type
());
riBuf
.
create
(
right
.
size
(),
right
.
type
());
impl
::
prefilter_xsobel
(
left
,
leBuf
);
impl
::
prefilter_xsobel
(
right
,
riBuf
);
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
,
stream
);
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
)
{
::
stereo_gpu_operator
(
minSSD
,
leBuf
,
riBuf
,
preset
,
ndisp
,
winSize
,
avergeTexThreshold
,
left
,
right
,
disparity
,
0
);
}
void
cv
::
gpu
::
StereoBM_GPU
::
operator
()
(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
const
CudaStream
&
stream
)
{
CV_Assert
(
!
"Not implemented"
);
::
stereo_gpu_operator
(
minSSD
,
leBuf
,
riBuf
,
preset
,
ndisp
,
winSize
,
avergeTexThreshold
,
left
,
right
,
disparity
,
StreamAccessor
::
getStream
(
stream
)
);
}
#endif
/* !defined (HAVE_CUDA) */
\ No newline at end of file
#endif
/* !defined (HAVE_CUDA) */
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