Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
28d0e97c
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,发现更多精彩内容 >>
提交
28d0e97c
编写于
7月 30, 2018
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12004 from mshabunin:more-asserts
上级
5d12c070
1165fdd0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
36 addition
and
108 deletion
+36
-108
modules/core/src/arithm.cpp
modules/core/src/arithm.cpp
+2
-1
modules/core/src/copy.cpp
modules/core/src/copy.cpp
+2
-1
modules/core/src/mean.cpp
modules/core/src/mean.cpp
+3
-1
modules/core/src/rand.cpp
modules/core/src/rand.cpp
+2
-2
modules/core/test/test_arithm.cpp
modules/core/test/test_arithm.cpp
+3
-7
modules/core/test/test_concatenation.cpp
modules/core/test/test_concatenation.cpp
+24
-95
modules/core/test/test_rand.cpp
modules/core/test/test_rand.cpp
+0
-1
未找到文件。
modules/core/src/arithm.cpp
浏览文件 @
28d0e97c
...
...
@@ -1233,7 +1233,8 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
CV_Assert
(
op
==
CMP_LT
||
op
==
CMP_LE
||
op
==
CMP_EQ
||
op
==
CMP_NE
||
op
==
CMP_GE
||
op
==
CMP_GT
);
if
(
_src1
.
empty
()
||
_src2
.
empty
())
CV_Assert
(
_src1
.
empty
()
==
_src2
.
empty
());
if
(
_src1
.
empty
()
&&
_src2
.
empty
())
{
_dst
.
release
();
return
;
...
...
modules/core/src/copy.cpp
浏览文件 @
28d0e97c
...
...
@@ -411,7 +411,8 @@ Mat& Mat::operator = (const Scalar& s)
{
CV_INSTRUMENT_REGION
()
if
(
empty
())
return
*
this
;
if
(
this
->
empty
())
return
*
this
;
const
Mat
*
arrays
[]
=
{
this
};
uchar
*
dptr
;
...
...
modules/core/src/mean.cpp
浏览文件 @
28d0e97c
...
...
@@ -766,11 +766,13 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
{
CV_INSTRUMENT_REGION
()
CV_Assert
(
!
_src
.
empty
());
CV_Assert
(
_mask
.
empty
()
||
_mask
.
type
()
==
CV_8UC1
);
CV_OCL_RUN
(
OCL_PERFORMANCE_CHECK
(
_src
.
isUMat
())
&&
_src
.
dims
()
<=
2
,
ocl_meanStdDev
(
_src
,
_mean
,
_sdv
,
_mask
))
Mat
src
=
_src
.
getMat
(),
mask
=
_mask
.
getMat
();
CV_Assert
(
mask
.
empty
()
||
mask
.
type
()
==
CV_8UC1
);
CV_OVX_RUN
(
!
ovx
::
skipSmallImages
<
VX_KERNEL_MEAN_STDDEV
>
(
src
.
cols
,
src
.
rows
),
openvx_meanStdDev
(
src
,
_mean
,
_sdv
,
mask
))
...
...
modules/core/src/rand.cpp
浏览文件 @
28d0e97c
...
...
@@ -511,8 +511,8 @@ static RandnScaleFunc randnScaleTab[] =
void
RNG
::
fill
(
InputOutputArray
_mat
,
int
disttype
,
InputArray
_param1arg
,
InputArray
_param2arg
,
bool
saturateRange
)
{
if
(
_mat
.
empty
())
return
;
CV_Assert
(
!
_mat
.
empty
());
Mat
mat
=
_mat
.
getMat
(),
_param1
=
_param1arg
.
getMat
(),
_param2
=
_param2arg
.
getMat
();
int
depth
=
mat
.
depth
(),
cn
=
mat
.
channels
();
AutoBuffer
<
double
>
_parambuf
;
...
...
modules/core/test/test_arithm.cpp
浏览文件 @
28d0e97c
...
...
@@ -1967,11 +1967,9 @@ TEST(Subtract, scalarc4_matc4)
TEST
(
Compare
,
empty
)
{
cv
::
Mat
temp
,
dst1
,
dst2
;
cv
::
compare
(
temp
,
temp
,
dst1
,
cv
::
CMP_EQ
);
dst2
=
temp
>
5
;
EXPECT_NO_THROW
(
cv
::
compare
(
temp
,
temp
,
dst1
,
cv
::
CMP_EQ
));
EXPECT_TRUE
(
dst1
.
empty
());
EXPECT_T
RUE
(
dst2
.
empty
()
);
EXPECT_T
HROW
(
dst2
=
temp
>
5
,
cv
::
Exception
);
}
TEST
(
Compare
,
regression_8999
)
...
...
@@ -1979,9 +1977,7 @@ TEST(Compare, regression_8999)
Mat_
<
double
>
A
(
4
,
1
);
A
<<
1
,
3
,
2
,
4
;
Mat_
<
double
>
B
(
1
,
1
);
B
<<
2
;
Mat
C
;
ASSERT_ANY_THROW
({
cv
::
compare
(
A
,
B
,
C
,
CMP_LT
);
});
EXPECT_THROW
(
cv
::
compare
(
A
,
B
,
C
,
CMP_LT
),
cv
::
Exception
);
}
...
...
modules/core/test/test_concatenation.cpp
浏览文件 @
28d0e97c
...
...
@@ -43,106 +43,35 @@
namespace
opencv_test
{
namespace
{
class
Core_ConcatenationTest
:
public
cvtest
::
BaseTest
TEST
(
Core_Concatenation
,
empty
)
{
public:
Core_ConcatenationTest
(
bool
horizontal
,
bool
firstEmpty
,
bool
secondEmpty
);
protected:
int
prepare_test_case
(
int
);
void
run_func
();
int
validate_test_results
(
int
);
const
Mat
mat0x5
(
0
,
5
,
CV_8U
,
Scalar
::
all
(
1
));
const
Mat
mat10x5
(
10
,
5
,
CV_8U
,
Scalar
::
all
(
1
));
const
Mat
mat20x5
(
20
,
5
,
CV_8U
,
Scalar
::
all
(
1
));
Mat
mat0x5
;
Mat
mat10x5
;
Mat
mat20x5
;
Mat
mat5x0
;
Mat
mat5x10
;
Mat
mat5x20
;
const
Mat
mat5x0
(
5
,
0
,
CV_8U
,
Scalar
::
all
(
1
));
const
Mat
mat5x10
(
5
,
10
,
CV_8U
,
Scalar
::
all
(
1
));
const
Mat
mat5x20
(
5
,
20
,
CV_8U
,
Scalar
::
all
(
1
));
Mat
result
;
bool
horizontal
;
bool
firstEmpty
;
bool
secondEmpty
;
private:
static
bool
areEqual
(
const
Mat
&
m1
,
const
Mat
&
m2
);
};
Core_ConcatenationTest
::
Core_ConcatenationTest
(
bool
horizontal_
,
bool
firstEmpty_
,
bool
secondEmpty_
)
:
horizontal
(
horizontal_
)
,
firstEmpty
(
firstEmpty_
)
,
secondEmpty
(
secondEmpty_
)
{
test_case_count
=
1
;
mat0x5
=
Mat
::
ones
(
0
,
5
,
CV_8U
);
mat10x5
=
Mat
::
ones
(
10
,
5
,
CV_8U
);
mat20x5
=
Mat
::
ones
(
20
,
5
,
CV_8U
);
mat5x0
=
Mat
::
ones
(
5
,
0
,
CV_8U
);
mat5x10
=
Mat
::
ones
(
5
,
10
,
CV_8U
);
mat5x20
=
Mat
::
ones
(
5
,
20
,
CV_8U
);
}
int
Core_ConcatenationTest
::
prepare_test_case
(
int
test_case_idx
)
{
cvtest
::
BaseTest
::
prepare_test_case
(
test_case_idx
);
return
1
;
}
void
Core_ConcatenationTest
::
run_func
()
{
if
(
horizontal
)
{
cv
::
hconcat
((
firstEmpty
?
mat5x0
:
mat5x10
),
(
secondEmpty
?
mat5x0
:
mat5x10
),
result
);
}
else
{
cv
::
vconcat
((
firstEmpty
?
mat0x5
:
mat10x5
),
(
secondEmpty
?
mat0x5
:
mat10x5
),
result
);
}
}
int
Core_ConcatenationTest
::
validate_test_results
(
int
)
{
Mat
expected
;
if
(
firstEmpty
&&
secondEmpty
)
expected
=
(
horizontal
?
mat5x0
:
mat0x5
);
else
if
((
firstEmpty
&&
!
secondEmpty
)
||
(
!
firstEmpty
&&
secondEmpty
))
expected
=
(
horizontal
?
mat5x10
:
mat10x5
);
else
expected
=
(
horizontal
?
mat5x20
:
mat20x5
);
if
(
areEqual
(
expected
,
result
))
{
return
cvtest
::
TS
::
OK
;
}
else
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Concatenation failed"
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_MISMATCH
);
}
return
cvtest
::
TS
::
OK
;
}
bool
Core_ConcatenationTest
::
areEqual
(
const
Mat
&
m1
,
const
Mat
&
m2
)
{
return
m1
.
size
()
==
m2
.
size
()
&&
m1
.
type
()
==
m2
.
type
()
&&
countNonZero
(
m1
!=
m2
)
==
0
;
cv
::
hconcat
(
mat5x0
,
mat5x0
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat5x0
,
0
);
cv
::
hconcat
(
mat5x0
,
mat5x10
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat5x10
,
0
);
cv
::
hconcat
(
mat5x10
,
mat5x0
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat5x10
,
0
);
cv
::
hconcat
(
mat5x10
,
mat5x10
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat5x20
,
0
);
cv
::
vconcat
(
mat0x5
,
mat0x5
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat0x5
,
0
);
cv
::
vconcat
(
mat0x5
,
mat10x5
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat10x5
,
0
);
cv
::
vconcat
(
mat10x5
,
mat0x5
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat10x5
,
0
);
cv
::
vconcat
(
mat10x5
,
mat10x5
,
result
);
EXPECT_MAT_N_DIFF
(
result
,
mat20x5
,
0
);
}
TEST
(
Core_Concatenation
,
hconcat_empty_nonempty
)
{
Core_ConcatenationTest
test
(
true
,
true
,
false
);
test
.
safe_run
();
}
TEST
(
Core_Concatenation
,
hconcat_nonempty_empty
)
{
Core_ConcatenationTest
test
(
true
,
false
,
true
);
test
.
safe_run
();
}
TEST
(
Core_Concatenation
,
hconcat_empty_empty
)
{
Core_ConcatenationTest
test
(
true
,
true
,
true
);
test
.
safe_run
();
}
TEST
(
Core_Concatenation
,
vconcat_empty_nonempty
)
{
Core_ConcatenationTest
test
(
false
,
true
,
false
);
test
.
safe_run
();
}
TEST
(
Core_Concatenation
,
vconcat_nonempty_empty
)
{
Core_ConcatenationTest
test
(
false
,
false
,
true
);
test
.
safe_run
();
}
TEST
(
Core_Concatenation
,
vconcat_empty_empty
)
{
Core_ConcatenationTest
test
(
false
,
true
,
true
);
test
.
safe_run
();
}
}}
// namespace
modules/core/test/test_rand.cpp
浏览文件 @
28d0e97c
...
...
@@ -173,7 +173,6 @@ void Core_RandTest::run( int )
dsz
=
slice
+
1
<
maxSlice
?
(
int
)(
cvtest
::
randInt
(
rng
)
%
(
SZ
-
sz
)
+
1
)
:
SZ
-
sz
;
Mat
aslice
=
arr
[
k
].
colRange
(
sz
,
sz
+
dsz
);
tested_rng
.
fill
(
aslice
,
dist_type
,
A
,
B
);
//printf("%d - %d\n", sz, sz + dsz);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录