Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
6062fad7
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6062fad7
编写于
8月 13, 2010
作者:
V
Vladislav Vinogradov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added minimum disparity threshold parameter to StereoConstantSpaceBP
上级
9c875a80
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
19 deletion
+24
-19
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+4
-1
modules/gpu/src/constantspacebp_gpu.cpp
modules/gpu/src/constantspacebp_gpu.cpp
+15
-13
modules/gpu/src/cuda/constantspacebp.cu
modules/gpu/src/cuda/constantspacebp.cu
+5
-5
未找到文件。
modules/gpu/include/opencv2/gpu/gpu.hpp
浏览文件 @
6062fad7
...
@@ -441,9 +441,10 @@ namespace cv
...
@@ -441,9 +441,10 @@ namespace cv
//! the full constructor taking the number of disparities, number of BP iterations on each level,
//! the full constructor taking the number of disparities, number of BP iterations on each level,
//! number of levels, number of active disparity on the first level, truncation of data cost, data weight,
//! number of levels, number of active disparity on the first level, truncation of data cost, data weight,
//! truncation of discontinuity cost
and discontinuity single jump
//! truncation of discontinuity cost
, discontinuity single jump and minimum disparity threshold
StereoConstantSpaceBP
(
int
ndisp
,
int
iters
,
int
levels
,
int
nr_plane
,
StereoConstantSpaceBP
(
int
ndisp
,
int
iters
,
int
levels
,
int
nr_plane
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
int
min_disp_th
=
0
,
int
msg_type
=
CV_32F
);
int
msg_type
=
CV_32F
);
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
//! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair,
...
@@ -465,6 +466,8 @@ namespace cv
...
@@ -465,6 +466,8 @@ namespace cv
float
max_disc_term
;
float
max_disc_term
;
float
disc_single_jump
;
float
disc_single_jump
;
int
min_disp_th
;
int
msg_type
;
int
msg_type
;
private:
private:
GpuMat
u
[
2
],
d
[
2
],
l
[
2
],
r
[
2
];
GpuMat
u
[
2
],
d
[
2
],
l
[
2
],
r
[
2
];
...
...
modules/gpu/src/constantspacebp_gpu.cpp
浏览文件 @
6062fad7
...
@@ -58,8 +58,8 @@ void cv::gpu::StereoConstantSpaceBP::operator()(const GpuMat&, const GpuMat&, Gp
...
@@ -58,8 +58,8 @@ void cv::gpu::StereoConstantSpaceBP::operator()(const GpuMat&, const GpuMat&, Gp
namespace
cv
{
namespace
gpu
{
namespace
csbp
namespace
cv
{
namespace
gpu
{
namespace
csbp
{
{
void
load_constants
(
int
ndisp
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
void
load_constants
(
int
ndisp
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
int
min_disp_th
,
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
temp
/*, const DevMem2D& temp2*/
);
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
temp
);
void
init_data_cost
(
int
rows
,
int
cols
,
const
DevMem2D
&
disp_selected_pyr
,
const
DevMem2D
&
data_cost_selected
,
void
init_data_cost
(
int
rows
,
int
cols
,
const
DevMem2D
&
disp_selected_pyr
,
const
DevMem2D
&
data_cost_selected
,
size_t
msg_step
,
int
msg_type
,
int
h
,
int
w
,
int
level
,
int
nr_plane
,
int
ndisp
,
int
channels
,
size_t
msg_step
,
int
msg_type
,
int
h
,
int
w
,
int
level
,
int
nr_plane
,
int
ndisp
,
int
channels
,
...
@@ -86,33 +86,35 @@ namespace cv { namespace gpu { namespace csbp
...
@@ -86,33 +86,35 @@ namespace cv { namespace gpu { namespace csbp
namespace
namespace
{
{
const
float
DEFAULT_MAX_DATA_TERM
=
1
0.0
f
;
const
float
DEFAULT_MAX_DATA_TERM
=
3
0.0
f
;
const
float
DEFAULT_DATA_WEIGHT
=
0.07
f
;
const
float
DEFAULT_DATA_WEIGHT
=
1.0
f
;
const
float
DEFAULT_MAX_DISC_TERM
=
1
.7
f
;
const
float
DEFAULT_MAX_DISC_TERM
=
1
60.0
f
;
const
float
DEFAULT_DISC_SINGLE_JUMP
=
1.0
f
;
const
float
DEFAULT_DISC_SINGLE_JUMP
=
1
0
.0
f
;
}
}
cv
::
gpu
::
StereoConstantSpaceBP
::
StereoConstantSpaceBP
(
int
ndisp_
,
int
iters_
,
int
levels_
,
int
nr_plane_
,
cv
::
gpu
::
StereoConstantSpaceBP
::
StereoConstantSpaceBP
(
int
ndisp_
,
int
iters_
,
int
levels_
,
int
nr_plane_
,
int
msg_type_
)
int
msg_type_
)
:
ndisp
(
ndisp_
),
iters
(
iters_
),
levels
(
levels_
),
nr_plane
(
nr_plane_
),
:
ndisp
(
ndisp_
),
iters
(
iters_
),
levels
(
levels_
),
nr_plane
(
nr_plane_
),
max_data_term
(
DEFAULT_MAX_DATA_TERM
),
data_weight
(
DEFAULT_DATA_WEIGHT
),
max_data_term
(
DEFAULT_MAX_DATA_TERM
),
data_weight
(
DEFAULT_DATA_WEIGHT
),
max_disc_term
(
DEFAULT_MAX_DISC_TERM
),
disc_single_jump
(
DEFAULT_DISC_SINGLE_JUMP
),
max_disc_term
(
DEFAULT_MAX_DISC_TERM
),
disc_single_jump
(
DEFAULT_DISC_SINGLE_JUMP
),
min_disp_th
(
0
),
msg_type
(
msg_type_
)
msg_type
(
msg_type_
)
{
{
}
}
cv
::
gpu
::
StereoConstantSpaceBP
::
StereoConstantSpaceBP
(
int
ndisp_
,
int
iters_
,
int
levels_
,
int
nr_plane_
,
cv
::
gpu
::
StereoConstantSpaceBP
::
StereoConstantSpaceBP
(
int
ndisp_
,
int
iters_
,
int
levels_
,
int
nr_plane_
,
float
max_data_term_
,
float
data_weight_
,
float
max_disc_term_
,
float
disc_single_jump_
,
float
max_data_term_
,
float
data_weight_
,
float
max_disc_term_
,
float
disc_single_jump_
,
int
min_disp_th_
,
int
msg_type_
)
int
msg_type_
)
:
ndisp
(
ndisp_
),
iters
(
iters_
),
levels
(
levels_
),
nr_plane
(
nr_plane_
),
:
ndisp
(
ndisp_
),
iters
(
iters_
),
levels
(
levels_
),
nr_plane
(
nr_plane_
),
max_data_term
(
max_data_term_
),
data_weight
(
data_weight_
),
max_data_term
(
max_data_term_
),
data_weight
(
data_weight_
),
max_disc_term
(
max_disc_term_
),
disc_single_jump
(
disc_single_jump_
),
max_disc_term
(
max_disc_term_
),
disc_single_jump
(
disc_single_jump_
),
min_disp_th
(
min_disp_th_
),
msg_type
(
msg_type_
)
msg_type
(
msg_type_
)
{
{
}
}
static
void
stereo_csbp_gpu_operator
(
int
&
ndisp
,
int
&
iters
,
int
&
levels
,
int
&
nr_plane
,
static
void
stereo_csbp_gpu_operator
(
int
&
ndisp
,
int
&
iters
,
int
&
levels
,
int
&
nr_plane
,
float
&
max_data_term
,
float
&
data_weight
,
float
&
max_disc_term
,
float
&
disc_single_jump
,
float
&
max_data_term
,
float
&
data_weight
,
float
&
max_disc_term
,
float
&
disc_single_jump
,
int
&
min_disp_th
,
int
&
msg_type
,
int
&
msg_type
,
GpuMat
u
[
2
],
GpuMat
d
[
2
],
GpuMat
l
[
2
],
GpuMat
r
[
2
],
GpuMat
u
[
2
],
GpuMat
d
[
2
],
GpuMat
l
[
2
],
GpuMat
r
[
2
],
GpuMat
disp_selected_pyr
[
2
],
GpuMat
&
data_cost
,
GpuMat
&
data_cost_selected
,
GpuMat
disp_selected_pyr
[
2
],
GpuMat
&
data_cost
,
GpuMat
&
data_cost_selected
,
...
@@ -195,7 +197,7 @@ static void stereo_csbp_gpu_operator(int& ndisp, int& iters, int& levels, int& n
...
@@ -195,7 +197,7 @@ static void stereo_csbp_gpu_operator(int& ndisp, int& iters, int& levels, int& n
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Compute
// Compute
csbp
::
load_constants
(
ndisp
,
max_data_term
,
scale
*
data_weight
,
scale
*
max_disc_term
,
scale
*
disc_single_jump
,
csbp
::
load_constants
(
ndisp
,
max_data_term
,
scale
*
data_weight
,
scale
*
max_disc_term
,
scale
*
disc_single_jump
,
min_disp_th
,
left
,
right
,
temp
);
left
,
right
,
temp
);
l
[
0
]
=
zero
;
l
[
0
]
=
zero
;
...
@@ -257,14 +259,14 @@ static void stereo_csbp_gpu_operator(int& ndisp, int& iters, int& levels, int& n
...
@@ -257,14 +259,14 @@ static void stereo_csbp_gpu_operator(int& ndisp, int& iters, int& levels, int& n
void
cv
::
gpu
::
StereoConstantSpaceBP
::
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disp
)
void
cv
::
gpu
::
StereoConstantSpaceBP
::
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disp
)
{
{
::
stereo_csbp_gpu_operator
(
ndisp
,
iters
,
levels
,
nr_plane
,
max_data_term
,
data_weight
,
max_disc_term
,
disc_single_jump
,
msg_type
,
::
stereo_csbp_gpu_operator
(
ndisp
,
iters
,
levels
,
nr_plane
,
max_data_term
,
data_weight
,
max_disc_term
,
disc_single_jump
,
m
in_disp_th
,
m
sg_type
,
u
,
d
,
l
,
r
,
disp_selected_pyr
,
data_cost
,
data_cost_selected
,
temp
/*, temp2*/
,
out
,
left
,
right
,
disp
,
0
);
u
,
d
,
l
,
r
,
disp_selected_pyr
,
data_cost
,
data_cost_selected
,
temp
,
out
,
left
,
right
,
disp
,
0
);
}
}
void
cv
::
gpu
::
StereoConstantSpaceBP
::
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disp
,
const
Stream
&
stream
)
void
cv
::
gpu
::
StereoConstantSpaceBP
::
operator
()(
const
GpuMat
&
left
,
const
GpuMat
&
right
,
GpuMat
&
disp
,
const
Stream
&
stream
)
{
{
::
stereo_csbp_gpu_operator
(
ndisp
,
iters
,
levels
,
nr_plane
,
max_data_term
,
data_weight
,
max_disc_term
,
disc_single_jump
,
msg_type
,
::
stereo_csbp_gpu_operator
(
ndisp
,
iters
,
levels
,
nr_plane
,
max_data_term
,
data_weight
,
max_disc_term
,
disc_single_jump
,
m
in_disp_th
,
m
sg_type
,
u
,
d
,
l
,
r
,
disp_selected_pyr
,
data_cost
,
data_cost_selected
,
temp
/*, temp2*/
,
out
,
left
,
right
,
disp
,
u
,
d
,
l
,
r
,
disp_selected_pyr
,
data_cost
,
data_cost_selected
,
temp
,
out
,
left
,
right
,
disp
,
StreamAccessor
::
getStream
(
stream
));
StreamAccessor
::
getStream
(
stream
));
}
}
...
...
modules/gpu/src/cuda/constantspacebp.cu
浏览文件 @
6062fad7
...
@@ -77,12 +77,13 @@ struct TypeLimits<float>
...
@@ -77,12 +77,13 @@ struct TypeLimits<float>
namespace
csbp_kernels
namespace
csbp_kernels
{
{
__constant__
int
cndisp
;
__constant__
int
cndisp
;
__constant__
int
cth
;
__constant__
float
cmax_data_term
;
__constant__
float
cmax_data_term
;
__constant__
float
cdata_weight
;
__constant__
float
cdata_weight
;
__constant__
float
cmax_disc_term
;
__constant__
float
cmax_disc_term
;
__constant__
float
cdisc_single_jump
;
__constant__
float
cdisc_single_jump
;
__constant__
int
cth
;
__constant__
size_t
cimg_step
;
__constant__
size_t
cimg_step
;
__constant__
size_t
cmsg_step1
;
__constant__
size_t
cmsg_step1
;
...
@@ -97,19 +98,18 @@ namespace csbp_kernels
...
@@ -97,19 +98,18 @@ namespace csbp_kernels
namespace
cv
{
namespace
gpu
{
namespace
csbp
namespace
cv
{
namespace
gpu
{
namespace
csbp
{
{
void
load_constants
(
int
ndisp
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
void
load_constants
(
int
ndisp
,
float
max_data_term
,
float
data_weight
,
float
max_disc_term
,
float
disc_single_jump
,
int
min_disp_th
,
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
temp
)
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
temp
)
{
{
int
th
=
(
int
)(
ndisp
*
0.2
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cndisp
,
&
ndisp
,
sizeof
(
int
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cndisp
,
&
ndisp
,
sizeof
(
int
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cth
,
&
th
,
sizeof
(
int
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cmax_data_term
,
&
max_data_term
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cmax_data_term
,
&
max_data_term
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cdata_weight
,
&
data_weight
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cdata_weight
,
&
data_weight
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cmax_disc_term
,
&
max_disc_term
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cmax_disc_term
,
&
max_disc_term
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cdisc_single_jump
,
&
disc_single_jump
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cdisc_single_jump
,
&
disc_single_jump
,
sizeof
(
float
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cth
,
&
min_disp_th
,
sizeof
(
int
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cimg_step
,
&
left
.
step
,
sizeof
(
size_t
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cimg_step
,
&
left
.
step
,
sizeof
(
size_t
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cleft
,
&
left
.
ptr
,
sizeof
(
left
.
ptr
))
);
cudaSafeCall
(
cudaMemcpyToSymbol
(
csbp_kernels
::
cleft
,
&
left
.
ptr
,
sizeof
(
left
.
ptr
))
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录