Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
cd6e7ac4
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
cd6e7ac4
编写于
9月 19, 2016
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7252 from terfendail:transparent_sobel_fix
上级
86f01c25
48f132f3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
11 deletion
+60
-11
modules/imgproc/src/canny.cpp
modules/imgproc/src/canny.cpp
+3
-0
modules/imgproc/src/deriv.cpp
modules/imgproc/src/deriv.cpp
+5
-1
modules/imgproc/test/ocl/test_canny.cpp
modules/imgproc/test/ocl/test_canny.cpp
+2
-10
modules/imgproc/test/test_filter.cpp
modules/imgproc/test/test_filter.cpp
+50
-0
未找到文件。
modules/imgproc/src/canny.cpp
浏览文件 @
cd6e7ac4
...
...
@@ -69,6 +69,9 @@ static bool ippCanny(const Mat& _src, const Mat& dx_, const Mat& dy_, Mat& _dst,
CV_INSTRUMENT_REGION_IPP
()
#if USE_IPP_CANNY
if
(
!
useCustomDeriv
&&
_src
.
isSubmatrix
())
return
false
;
// IPP Sobel doesn't support transparent ROI border
int
size
=
0
,
size1
=
0
;
IppiSize
roi
=
{
_src
.
cols
,
_src
.
rows
};
...
...
modules/imgproc/src/deriv.cpp
浏览文件 @
cd6e7ac4
...
...
@@ -307,7 +307,7 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
{
CV_INSTRUMENT_REGION_IPP
()
if
((
borderType
!=
BORDER_REPLICATE
)
||
((
3
!=
ksize
)
&&
(
5
!=
ksize
)))
if
((
(
borderType
&
~
BORDER_ISOLATED
)
!=
BORDER_REPLICATE
)
||
((
3
!=
ksize
)
&&
(
5
!=
ksize
)))
return
false
;
if
(
fabs
(
delta
)
>
FLT_EPSILON
)
return
false
;
...
...
@@ -317,6 +317,10 @@ static bool IPPDerivSobel(InputArray _src, OutputArray _dst, int ddepth, int dx,
int
bufSize
=
0
;
cv
::
AutoBuffer
<
char
>
buffer
;
Mat
src
=
_src
.
getMat
(),
dst
=
_dst
.
getMat
();
if
((
borderType
&
BORDER_ISOLATED
)
==
0
&&
src
.
isSubmatrix
())
return
false
;
if
(
ddepth
<
0
)
ddepth
=
src
.
depth
();
...
...
modules/imgproc/test/ocl/test_canny.cpp
浏览文件 @
cd6e7ac4
...
...
@@ -99,11 +99,7 @@ OCL_TEST_P(Canny, Accuracy)
generateTestData
();
const
double
low_thresh
=
50.0
,
high_thresh
=
100.0
;
double
eps
=
1e-2
;
#ifdef ANDROID
if
(
cv
::
ocl
::
Device
::
getDefault
().
isNVidia
())
eps
=
12e-3
;
#endif
double
eps
=
12e-3
;
OCL_OFF
(
cv
::
Canny
(
src_roi
,
dst_roi
,
low_thresh
,
high_thresh
,
aperture_size
,
useL2gradient
));
OCL_ON
(
cv
::
Canny
(
usrc_roi
,
udst_roi
,
low_thresh
,
high_thresh
,
aperture_size
,
useL2gradient
));
...
...
@@ -117,11 +113,7 @@ OCL_TEST_P(Canny, AccuracyCustomGradient)
generateTestData
();
const
double
low_thresh
=
50.0
,
high_thresh
=
100.0
;
double
eps
=
1e-2
;
#ifdef ANDROID
if
(
cv
::
ocl
::
Device
::
getDefault
().
isNVidia
())
eps
=
12e-3
;
#endif
double
eps
=
12e-3
;
OCL_OFF
(
cv
::
Canny
(
src_roi
,
dst_roi
,
low_thresh
,
high_thresh
,
aperture_size
,
useL2gradient
));
OCL_ON
(
...
...
modules/imgproc/test/test_filter.cpp
浏览文件 @
cd6e7ac4
...
...
@@ -2015,3 +2015,53 @@ TEST(Imgproc_Morphology, iterated)
ASSERT_EQ
(
0.0
,
norm
(
dst0
,
dst2
,
NORM_INF
));
}
}
TEST
(
Imgproc_Sobel
,
borderTypes
)
{
int
kernelSize
=
3
;
/// ksize > src_roi.size()
Mat
src
=
(
Mat_
<
uchar
>
(
3
,
3
)
<<
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
),
dst
,
expected_dst
;
Mat
src_roi
=
src
(
Rect
(
1
,
1
,
1
,
1
));
src_roi
.
setTo
(
cv
::
Scalar
::
all
(
0
));
// should work like !BORDER_ISOLATED, so the function MUST read values in full matrix
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REPLICATE
);
EXPECT_EQ
(
8
,
dst
.
at
<
short
>
(
0
,
0
));
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REFLECT
);
EXPECT_EQ
(
8
,
dst
.
at
<
short
>
(
0
,
0
));
// should work like BORDER_ISOLATED
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REPLICATE
|
BORDER_ISOLATED
);
EXPECT_EQ
(
0
,
dst
.
at
<
short
>
(
0
,
0
));
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REFLECT
|
BORDER_ISOLATED
);
EXPECT_EQ
(
0
,
dst
.
at
<
short
>
(
0
,
0
));
/// ksize <= src_roi.size()
src
=
Mat
(
5
,
5
,
CV_8UC1
,
cv
::
Scalar
(
5
));
src_roi
=
src
(
Rect
(
1
,
1
,
3
,
3
));
src_roi
.
setTo
(
0
);
// should work like !BORDER_ISOLATED, so the function MUST read values in full matrix
expected_dst
=
(
Mat_
<
short
>
(
3
,
3
)
<<
-
15
,
0
,
15
,
-
20
,
0
,
20
,
-
15
,
0
,
15
);
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REPLICATE
);
EXPECT_EQ
(
expected_dst
.
type
(),
dst
.
type
());
EXPECT_EQ
(
expected_dst
.
size
(),
dst
.
size
());
EXPECT_DOUBLE_EQ
(
0.0
,
cvtest
::
norm
(
expected_dst
,
dst
,
NORM_INF
));
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REFLECT
);
EXPECT_EQ
(
expected_dst
.
type
(),
dst
.
type
());
EXPECT_EQ
(
expected_dst
.
size
(),
dst
.
size
());
EXPECT_DOUBLE_EQ
(
0.0
,
cvtest
::
norm
(
expected_dst
,
dst
,
NORM_INF
));
// should work like !BORDER_ISOLATED, so the function MUST read values in full matrix
expected_dst
=
Mat
::
zeros
(
3
,
3
,
CV_16SC1
);
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REPLICATE
|
BORDER_ISOLATED
);
EXPECT_EQ
(
expected_dst
.
type
(),
dst
.
type
());
EXPECT_EQ
(
expected_dst
.
size
(),
dst
.
size
());
EXPECT_DOUBLE_EQ
(
0.0
,
cvtest
::
norm
(
expected_dst
,
dst
,
NORM_INF
));
Sobel
(
src_roi
,
dst
,
CV_16S
,
1
,
0
,
kernelSize
,
1
,
0
,
BORDER_REFLECT
|
BORDER_ISOLATED
);
EXPECT_EQ
(
expected_dst
.
type
(),
dst
.
type
());
EXPECT_EQ
(
expected_dst
.
size
(),
dst
.
size
());
EXPECT_DOUBLE_EQ
(
0.0
,
cvtest
::
norm
(
expected_dst
,
dst
,
NORM_INF
));
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录