Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
6fa41c5a
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
6fa41c5a
编写于
1月 30, 2014
作者:
I
Ilya Lavrenov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some experiments
上级
afa62c41
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
14 deletion
+66
-14
modules/imgproc/src/filter.cpp
modules/imgproc/src/filter.cpp
+58
-4
modules/imgproc/src/opencl/filterSepCol.cl
modules/imgproc/src/opencl/filterSepCol.cl
+2
-2
modules/imgproc/src/opencl/filterSepRow.cl
modules/imgproc/src/opencl/filterSepRow.cl
+6
-8
未找到文件。
modules/imgproc/src/filter.cpp
浏览文件 @
6fa41c5a
...
...
@@ -3313,6 +3313,56 @@ static bool ocl_filter2D( InputArray _src, OutputArray _dst, int ddepth,
return
kernel
.
run
(
2
,
globalsize
,
localsize
,
true
);
}
template
<
typename
T
>
static
std
::
string
kerToStr
(
const
Mat
&
k
)
{
int
width
=
k
.
cols
-
1
,
depth
=
k
.
depth
();
const
T
*
const
data
=
reinterpret_cast
<
const
T
*>
(
k
.
data
);
std
::
ostringstream
stream
;
stream
.
precision
(
10
);
if
(
depth
<=
CV_8S
)
{
for
(
int
i
=
0
;
i
<
width
;
++
i
)
stream
<<
(
int
)
data
[
i
]
<<
","
;
stream
<<
(
int
)
data
[
width
];
}
else
if
(
depth
==
CV_32F
)
{
for
(
int
i
=
0
;
i
<
width
;
++
i
)
stream
<<
data
[
i
]
<<
"f,"
;
stream
<<
data
[
width
]
<<
"f"
;
}
else
{
for
(
int
i
=
0
;
i
<
width
;
++
i
)
stream
<<
data
[
i
]
<<
","
;
}
return
stream
.
str
();
}
static
String
kernelToStr
(
InputArray
_kernel
,
int
ddepth
=
-
1
)
{
Mat
kernel
=
_kernel
.
getMat
().
reshape
(
1
,
1
);
int
depth
=
kernel
.
depth
();
if
(
ddepth
<
0
)
ddepth
=
depth
;
if
(
ddepth
!=
depth
)
kernel
.
convertTo
(
kernel
,
ddepth
);
typedef
std
::
string
(
*
func_t
)(
const
Mat
&
);
static
const
func_t
funcs
[]
=
{
kerToStr
<
uchar
>
,
kerToStr
<
char
>
,
kerToStr
<
ushort
>
,
kerToStr
<
short
>
,
kerToStr
<
int
>
,
kerToStr
<
float
>
,
kerToStr
<
double
>
,
0
};
const
func_t
func
=
funcs
[
depth
];
CV_Assert
(
func
!=
0
);
return
cv
::
format
(
" -D COEFF=%s"
,
func
(
kernel
).
c_str
());
}
static
bool
ocl_sepRowFilter2D
(
UMat
&
src
,
UMat
&
buf
,
Mat
&
kernelX
,
int
anchor
,
int
borderType
,
bool
sync
)
{
int
type
=
src
.
type
();
...
...
@@ -3378,6 +3428,7 @@ static bool ocl_sepRowFilter2D( UMat &src, UMat &buf, Mat &kernelX, int anchor,
btype
,
extra_extrapolation
?
"EXTRA_EXTRAPOLATION"
:
"NO_EXTRA_EXTRAPOLATION"
,
isIsolatedBorder
?
"BORDER_ISOLATED"
:
"NO_BORDER_ISOLATED"
);
build_options
+=
kernelToStr
(
kernelX
,
CV_32F
);
Size
srcWholeSize
;
Point
srcOffset
;
src
.
locateROI
(
srcWholeSize
,
srcOffset
);
...
...
@@ -3390,7 +3441,8 @@ static bool ocl_sepRowFilter2D( UMat &src, UMat &buf, Mat &kernelX, int anchor,
strKernel
<<
"_D"
<<
sdepth
;
ocl
::
Kernel
kernelRow
;
if
(
!
kernelRow
.
create
(
strKernel
.
str
().
c_str
(),
cv
::
ocl
::
imgproc
::
filterSepRow_oclsrc
,
build_options
))
if
(
!
kernelRow
.
create
(
strKernel
.
str
().
c_str
(),
cv
::
ocl
::
imgproc
::
filterSepRow_oclsrc
,
build_options
))
return
false
;
int
idxArg
=
0
;
...
...
@@ -3409,7 +3461,7 @@ static bool ocl_sepRowFilter2D( UMat &src, UMat &buf, Mat &kernelX, int anchor,
idxArg
=
kernelRow
.
set
(
idxArg
,
buf
.
cols
);
idxArg
=
kernelRow
.
set
(
idxArg
,
buf
.
rows
);
idxArg
=
kernelRow
.
set
(
idxArg
,
radiusY
);
idxArg
=
kernelRow
.
set
(
idxArg
,
ocl
::
KernelArg
::
PtrReadOnly
(
kernelX
.
getUMat
(
ACCESS_READ
)));
//
idxArg = kernelRow.set(idxArg, ocl::KernelArg::PtrReadOnly(kernelX.getUMat(ACCESS_READ)));
return
kernelRow
.
run
(
2
,
globalsize
,
localsize
,
sync
);
}
...
...
@@ -3479,6 +3531,8 @@ static bool ocl_sepColFilter2D(UMat &buf, UMat &dst, Mat &kernelY, int anchor, b
}
}
build_options
+=
kernelToStr
(
kernelY
,
CV_32F
);
ocl
::
Kernel
kernelCol
;
if
(
!
kernelCol
.
create
(
"col_filter"
,
cv
::
ocl
::
imgproc
::
filterSepCol_oclsrc
,
build_options
))
return
false
;
...
...
@@ -3494,7 +3548,7 @@ static bool ocl_sepColFilter2D(UMat &buf, UMat &dst, Mat &kernelY, int anchor, b
idxArg
=
kernelCol
.
set
(
idxArg
,
(
int
)(
dst
.
step
/
dst
.
elemSize
()));
idxArg
=
kernelCol
.
set
(
idxArg
,
dst
.
cols
);
idxArg
=
kernelCol
.
set
(
idxArg
,
dst
.
rows
);
idxArg
=
kernelCol
.
set
(
idxArg
,
ocl
::
KernelArg
::
PtrReadOnly
(
kernelY
.
getUMat
(
ACCESS_READ
)));
//
idxArg = kernelCol.set(idxArg, ocl::KernelArg::PtrReadOnly(kernelY.getUMat(ACCESS_READ)));
return
kernelCol
.
run
(
2
,
globalsize
,
localsize
,
sync
);
}
...
...
@@ -3508,7 +3562,7 @@ static bool ocl_sepFilter2D( InputArray _src, OutputArray _dst, int ddepth,
int
type
=
_src
.
type
();
if
(
!
(
(
CV_8UC1
==
type
||
CV_8UC4
==
type
||
CV_32FC1
==
type
||
CV_32FC4
==
type
)
&&
(
ddepth
==
CV_32F
||
ddepth
==
CV_8U
)
)
)
(
ddepth
==
CV_32F
||
ddepth
==
CV_8U
||
ddepth
<
0
)
)
)
return
false
;
int
cn
=
CV_MAT_CN
(
type
);
...
...
modules/imgproc/src/opencl/filterSepCol.cl
浏览文件 @
6fa41c5a
...
...
@@ -60,6 +60,7 @@ Niko
The
info
above
maybe
obsolete.
***********************************************************************************
/
__constant
float
mat_kernel[]
=
{
COEFF
}
;
__kernel
__attribute__
((
reqd_work_group_size
(
LSIZE0,LSIZE1,1
)))
void
col_filter
(
__global
const
GENTYPE_SRC
*
restrict
src,
...
...
@@ -70,8 +71,7 @@ __kernel __attribute__((reqd_work_group_size(LSIZE0,LSIZE1,1))) void col_filter
const
int
dst_offset_in_pixel,
const
int
dst_step_in_pixel,
const
int
dst_cols,
const
int
dst_rows,
__constant
float
*
mat_kernel
)
const
int
dst_rows
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
...
...
modules/imgproc/src/opencl/filterSepRow.cl
浏览文件 @
6fa41c5a
...
...
@@ -144,6 +144,8 @@ Niko
The
info
above
maybe
obsolete.
***********************************************************************************
/
__constant
float
mat_kernel[]
=
{
COEFF
}
;
__kernel
__attribute__
((
reqd_work_group_size
(
LSIZE0,LSIZE1,1
)))
void
row_filter_C1_D0
(
__global
uchar
*
restrict
src,
int
src_step_in_pixel,
...
...
@@ -153,8 +155,7 @@ __kernel __attribute__((reqd_work_group_size(LSIZE0,LSIZE1,1))) void row_filter_
__global
float
*
dst,
int
dst_step_in_pixel,
int
dst_cols,
int
dst_rows,
int
radiusy,
__constant
float
*
mat_kernel
)
int
radiusy
)
{
int
x
=
get_global_id
(
0
)
<<2
;
int
y
=
get_global_id
(
1
)
;
...
...
@@ -297,8 +298,7 @@ __kernel __attribute__((reqd_work_group_size(LSIZE0,LSIZE1,1))) void row_filter_
__global
float4
*
dst,
int
dst_step_in_pixel,
int
dst_cols,
int
dst_rows,
int
radiusy,
__constant
float
*
mat_kernel
)
int
radiusy
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
...
...
@@ -391,8 +391,7 @@ __kernel __attribute__((reqd_work_group_size(LSIZE0,LSIZE1,1))) void row_filter_
__global
float
*
dst,
int
dst_step_in_pixel,
int
dst_cols,
int
dst_rows,
int
radiusy,
__constant
float
*
mat_kernel
)
int
radiusy
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
...
...
@@ -484,8 +483,7 @@ __kernel __attribute__((reqd_work_group_size(LSIZE0,LSIZE1,1))) void row_filter_
__global
float4
*
dst,
int
dst_step_in_pixel,
int
dst_cols,
int
dst_rows,
int
radiusy,
__constant
float
*
mat_kernel
)
int
radiusy
)
{
int
x
=
get_global_id
(
0
)
;
int
y
=
get_global_id
(
1
)
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录