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
096080de
Commit
096080de
authored
Aug 25, 2010
by
Andrey Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added methods estimateRecopmmendedParams for StereoBP and StereoCSBP
parent
1febf345
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
17 deletions
+48
-17
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+12
-8
beliefpropagation_gpu.cpp
modules/gpu/src/beliefpropagation_gpu.cpp
+22
-9
constantspacebp_gpu.cpp
modules/gpu/src/constantspacebp_gpu.cpp
+14
-0
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
096080de
...
...
@@ -235,7 +235,7 @@ namespace cv
class
CV_EXPORTS
CudaMem
{
public
:
public
:
enum
{
ALLOC_PAGE_LOCKED
=
1
,
ALLOC_ZEROCOPY
=
2
,
ALLOC_WRITE_COMBINED
=
4
};
CudaMem
();
...
...
@@ -266,7 +266,7 @@ namespace cv
Mat
createMatHeader
()
const
;
operator
Mat
()
const
;
//! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware.
//! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware.
GpuMat
createGpuMatHeader
()
const
;
operator
GpuMat
()
const
;
...
...
@@ -342,7 +342,7 @@ namespace cv
};
////////////////////////////// Image processing //////////////////////////////
// DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.
// DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.
// xymap.type() == xymap.type() == CV_32FC1
CV_EXPORTS
void
remap
(
const
GpuMat
&
src
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
,
GpuMat
&
dst
);
...
...
@@ -376,7 +376,7 @@ namespace cv
//! the default constructor
StereoBM_GPU
();
//! the full constructor taking the camera-specific preset, number of disparities and the SAD window size. ndisparities must be multiple of 8.
//! the full constructor taking the camera-specific preset, number of disparities and the SAD window size. ndisparities must be multiple of 8.
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
...
...
@@ -405,7 +405,7 @@ namespace cv
};
////////////////////////// StereoBeliefPropagation ///////////////////////////
// "Efficient Belief Propagation for Early Vision"
// "Efficient Belief Propagation for Early Vision"
// P.Felzenszwalb
class
CV_EXPORTS
StereoBeliefPropagation
...
...
@@ -415,6 +415,8 @@ namespace cv
enum
{
DEFAULT_ITERS
=
5
};
enum
{
DEFAULT_LEVELS
=
5
};
static
void
estimateRecopmmendedParams
(
int
width
,
int
height
,
int
&
ndisp
,
int
&
iters
,
int
&
levels
);
//! the default constructor
explicit
StereoBeliefPropagation
(
int
ndisp
=
DEFAULT_NDISP
,
int
iters
=
DEFAULT_ITERS
,
...
...
@@ -436,7 +438,7 @@ namespace cv
//! Acync version
void
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disparity
,
Stream
&
stream
);
//! version for user specified data term
void
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disparity
);
void
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disparity
,
Stream
&
stream
);
...
...
@@ -460,7 +462,7 @@ namespace cv
/////////////////////////// StereoConstantSpaceBP ///////////////////////////
// "A Constant-Space Belief Propagation Algorithm for Stereo Matching"
// Qingxiong Yang, Liang Wang, Narendra Ahuj
a
// Qingxiong Yang, Liang Wang, Narendra Ahuja
// http://vision.ai.uiuc.edu/~qyang6/
class
CV_EXPORTS
StereoConstantSpaceBP
...
...
@@ -471,6 +473,8 @@ namespace cv
enum
{
DEFAULT_LEVELS
=
4
};
enum
{
DEFAULT_NR_PLANE
=
4
};
static
void
estimateRecopmmendedParams
(
int
width
,
int
height
,
int
&
ndisp
,
int
&
iters
,
int
&
levels
,
int
&
nr_plane
);
//! the default constructor
explicit
StereoConstantSpaceBP
(
int
ndisp
=
DEFAULT_NDISP
,
int
iters
=
DEFAULT_ITERS
,
...
...
@@ -524,7 +528,7 @@ namespace cv
/////////////////////////// DisparityBilateralFilter ///////////////////////////
// Disparity map refinement using joint bilateral filtering given a single color image.
// Qingxiong Yang, Liang Wang, Narendra Ahuj
a
// Qingxiong Yang, Liang Wang, Narendra Ahuja
// http://vision.ai.uiuc.edu/~qyang6/
class
CV_EXPORTS
DisparityBilateralFilter
...
...
modules/gpu/src/beliefpropagation_gpu.cpp
View file @
096080de
...
...
@@ -77,6 +77,19 @@ namespace
const
float
DEFAULT_DISC_SINGLE_JUMP
=
1.0
f
;
}
void
cv
::
gpu
::
StereoBeliefPropagation
::
estimateRecopmmendedParams
(
int
width
,
int
height
,
int
&
ndisp
,
int
&
iters
,
int
&
levels
)
{
ndisp
=
width
/
4
;
if
(
ndisp
&
1
!=
0
)
ndisp
++
;
int
mm
=::
max
(
width
,
height
);
iters
=
mm
/
100
+
2
;
levels
=
(
int
)(
log
(
mm
)
+
1
)
*
4
/
5
;
if
(
levels
==
0
)
levels
++
;
}
cv
::
gpu
::
StereoBeliefPropagation
::
StereoBeliefPropagation
(
int
ndisp_
,
int
iters_
,
int
levels_
,
int
msg_type_
)
:
ndisp
(
ndisp_
),
iters
(
iters_
),
levels
(
levels_
),
max_data_term
(
DEFAULT_MAX_DATA_TERM
),
data_weight
(
DEFAULT_DATA_WEIGHT
),
...
...
@@ -117,7 +130,7 @@ namespace
CV_DbgAssert
(
left
.
rows
==
right
.
rows
&&
left
.
cols
==
right
.
cols
&&
left
.
type
()
==
right
.
type
());
CV_Assert
(
left
.
type
()
==
CV_8UC1
||
left
.
type
()
==
CV_8UC3
);
rows
=
left
.
rows
;
rows
=
left
.
rows
;
cols
=
left
.
cols
;
int
divisor
=
(
int
)
pow
(
2.
f
,
rthis
.
levels
-
1.0
f
);
...
...
@@ -134,14 +147,14 @@ namespace
calcBP
(
disp
,
stream
);
}
void
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disp
,
const
cudaStream_t
&
stream
)
{
CV_Assert
((
data
.
type
()
==
rthis
.
msg_type
)
&&
(
data
.
rows
%
rthis
.
ndisp
==
0
));
rows
=
data
.
rows
/
rthis
.
ndisp
;
cols
=
data
.
cols
;
int
divisor
=
(
int
)
pow
(
2.
f
,
rthis
.
levels
-
1.0
f
);
int
lowest_cols
=
cols
/
divisor
;
int
lowest_rows
=
rows
/
divisor
;
...
...
@@ -198,7 +211,7 @@ namespace
rows_all
.
resize
(
rthis
.
levels
);
cols_all
[
0
]
=
cols
;
rows_all
[
0
]
=
rows
;
rows_all
[
0
]
=
rows
;
}
void
calcBP
(
GpuMat
&
disp
,
const
cudaStream_t
&
stream
)
...
...
@@ -279,14 +292,14 @@ void cv::gpu::StereoBeliefPropagation::operator()(const GpuMat& left, const GpuM
impl
(
left
,
right
,
disp
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
StereoBeliefPropagation
::
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disp
)
{
void
cv
::
gpu
::
StereoBeliefPropagation
::
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disp
)
{
::
StereoBeliefPropagationImpl
impl
(
*
this
,
u
,
d
,
l
,
r
,
u2
,
d2
,
l2
,
r2
,
datas
,
out
);
impl
(
data
,
disp
,
0
);
}
void
cv
::
gpu
::
StereoBeliefPropagation
::
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disp
,
Stream
&
stream
)
{
void
cv
::
gpu
::
StereoBeliefPropagation
::
operator
()(
const
GpuMat
&
data
,
GpuMat
&
disp
,
Stream
&
stream
)
{
::
StereoBeliefPropagationImpl
impl
(
*
this
,
u
,
d
,
l
,
r
,
u2
,
d2
,
l2
,
r2
,
datas
,
out
);
impl
(
data
,
disp
,
StreamAccessor
::
getStream
(
stream
));
}
...
...
modules/gpu/src/constantspacebp_gpu.cpp
View file @
096080de
...
...
@@ -105,6 +105,20 @@ namespace
const
float
DEFAULT_DISC_SINGLE_JUMP
=
10.0
f
;
}
void
cv
::
gpu
::
StereoConstantSpaceBP
::
estimateRecopmmendedParams
(
int
width
,
int
height
,
int
&
ndisp
,
int
&
iters
,
int
&
levels
,
int
&
nr_plane
)
{
ndisp
=
(
int
)
((
float
)
width
/
3.14
f
);
if
(
ndisp
&
1
!=
0
)
ndisp
++
;
int
mm
=
::
max
(
width
,
height
);
iters
=
mm
/
100
+
((
mm
>
1200
)
?
-
4
:
4
);
levels
=
(
int
)
log
(
mm
)
*
2
/
3
;
if
(
levels
==
0
)
levels
++
;
nr_plane
=
(
int
)
((
float
)
ndisp
/
pow
(
2.0
,
levels
+
1
));
}
cv
::
gpu
::
StereoConstantSpaceBP
::
StereoConstantSpaceBP
(
int
ndisp_
,
int
iters_
,
int
levels_
,
int
nr_plane_
,
int
msg_type_
)
...
...
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