Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
17e860a2
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 大约 1 年
通知
1005
Star
71102
Fork
55580
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
17e860a2
编写于
1月 20, 2023
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16189 from mshabunin:enable-two-channels
上级
e200b88a
69020666
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
73 deletion
+44
-73
modules/calib3d/test/test_homography.cpp
modules/calib3d/test/test_homography.cpp
+27
-58
modules/imgproc/test/test_color.cpp
modules/imgproc/test/test_color.cpp
+2
-2
modules/imgproc/test/test_convhull.cpp
modules/imgproc/test/test_convhull.cpp
+1
-1
modules/imgproc/test/test_imgwarp.cpp
modules/imgproc/test/test_imgwarp.cpp
+0
-1
modules/imgproc/test/test_imgwarp_strict.cpp
modules/imgproc/test/test_imgwarp_strict.cpp
+1
-5
modules/ts/src/ts.cpp
modules/ts/src/ts.cpp
+11
-4
modules/video/test/test_estimaterigid.cpp
modules/video/test/test_estimaterigid.cpp
+2
-2
未找到文件。
modules/calib3d/test/test_homography.cpp
浏览文件 @
17e860a2
...
...
@@ -73,60 +73,27 @@ int METHOD[METHODS_COUNT] = {0, cv::RANSAC, cv::LMEDS, cv::RHO};
using
namespace
cv
;
using
namespace
std
;
class
CV_HomographyTest
:
public
cvtest
::
ArrayTest
{
public:
CV_HomographyTest
();
~
CV_HomographyTest
();
void
run
(
int
);
protected:
int
method
;
int
image_size
;
double
reproj_threshold
;
double
sigma
;
private:
float
max_diff
,
max_2diff
;
bool
check_matrix_size
(
const
cv
::
Mat
&
H
);
bool
check_matrix_diff
(
const
cv
::
Mat
&
original
,
const
cv
::
Mat
&
found
,
const
int
norm_type
,
double
&
diff
);
int
check_ransac_mask_1
(
const
Mat
&
src
,
const
Mat
&
mask
);
int
check_ransac_mask_2
(
const
Mat
&
original_mask
,
const
Mat
&
found_mask
);
void
print_information_1
(
int
j
,
int
N
,
int
method
,
const
Mat
&
H
);
void
print_information_2
(
int
j
,
int
N
,
int
method
,
const
Mat
&
H
,
const
Mat
&
H_res
,
int
k
,
double
diff
);
void
print_information_3
(
int
method
,
int
j
,
int
N
,
const
Mat
&
mask
);
void
print_information_4
(
int
method
,
int
j
,
int
N
,
int
k
,
int
l
,
double
diff
);
void
print_information_5
(
int
method
,
int
j
,
int
N
,
int
l
,
double
diff
);
void
print_information_6
(
int
method
,
int
j
,
int
N
,
int
k
,
double
diff
,
bool
value
);
void
print_information_7
(
int
method
,
int
j
,
int
N
,
int
k
,
double
diff
,
bool
original_value
,
bool
found_value
);
void
print_information_8
(
int
method
,
int
j
,
int
N
,
int
k
,
int
l
,
double
diff
);
};
CV_HomographyTest
::
CV_HomographyTest
()
:
max_diff
(
1e-2
f
),
max_2diff
(
2e-2
f
)
{
method
=
0
;
image_size
=
100
;
reproj_threshold
=
3.0
;
sigma
=
0.01
;
}
CV_HomographyTest
::~
CV_HomographyTest
()
{}
namespace
HomographyTestUtils
{
static
const
float
max_diff
=
0.032
f
;
static
const
float
max_2diff
=
0.020
f
;
static
const
int
image_size
=
100
;
static
const
double
reproj_threshold
=
3.0
;
static
const
double
sigma
=
0.01
;
bool
CV_HomographyTest
::
check_matrix_size
(
const
cv
::
Mat
&
H
)
static
bool
check_matrix_size
(
const
cv
::
Mat
&
H
)
{
return
(
H
.
rows
==
3
)
&&
(
H
.
cols
==
3
);
}
bool
CV_HomographyTest
::
check_matrix_diff
(
const
cv
::
Mat
&
original
,
const
cv
::
Mat
&
found
,
const
int
norm_type
,
double
&
diff
)
static
bool
check_matrix_diff
(
const
cv
::
Mat
&
original
,
const
cv
::
Mat
&
found
,
const
int
norm_type
,
double
&
diff
)
{
diff
=
cvtest
::
norm
(
original
,
found
,
norm_type
);
return
diff
<=
max_diff
;
}
int
CV_HomographyTest
::
check_ransac_mask_1
(
const
Mat
&
src
,
const
Mat
&
mask
)
static
int
check_ransac_mask_1
(
const
Mat
&
src
,
const
Mat
&
mask
)
{
if
(
!
(
mask
.
cols
==
1
)
&&
(
mask
.
rows
==
src
.
cols
))
return
1
;
if
(
countNonZero
(
mask
)
<
mask
.
rows
)
return
2
;
...
...
@@ -134,14 +101,14 @@ int CV_HomographyTest::check_ransac_mask_1(const Mat& src, const Mat& mask)
return
0
;
}
int
CV_HomographyTest
::
check_ransac_mask_2
(
const
Mat
&
original_mask
,
const
Mat
&
found_mask
)
static
int
check_ransac_mask_2
(
const
Mat
&
original_mask
,
const
Mat
&
found_mask
)
{
if
(
!
(
found_mask
.
cols
==
1
)
&&
(
found_mask
.
rows
==
original_mask
.
rows
))
return
1
;
for
(
int
i
=
0
;
i
<
found_mask
.
rows
;
++
i
)
if
(
found_mask
.
at
<
uchar
>
(
i
,
0
)
>
1
)
return
2
;
return
0
;
}
void
CV_HomographyTest
::
print_information_1
(
int
j
,
int
N
,
int
_method
,
const
Mat
&
H
)
static
void
print_information_1
(
int
j
,
int
N
,
int
_method
,
const
Mat
&
H
)
{
cout
<<
endl
;
cout
<<
"Checking for homography matrix sizes..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Type of srcPoints: "
;
if
((
j
>-
1
)
&&
(
j
<
2
))
cout
<<
"Mat of CV_32FC2"
;
else
cout
<<
"vector <Point2f>"
;
...
...
@@ -153,7 +120,7 @@ void CV_HomographyTest::print_information_1(int j, int N, int _method, const Mat
cout
<<
"Number of rows: "
<<
H
.
rows
<<
" Number of cols: "
<<
H
.
cols
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_2
(
int
j
,
int
N
,
int
_method
,
const
Mat
&
H
,
const
Mat
&
H_res
,
int
k
,
double
diff
)
static
void
print_information_2
(
int
j
,
int
N
,
int
_method
,
const
Mat
&
H
,
const
Mat
&
H_res
,
int
k
,
double
diff
)
{
cout
<<
endl
;
cout
<<
"Checking for accuracy of homography matrix computing..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Type of srcPoints: "
;
if
((
j
>-
1
)
&&
(
j
<
2
))
cout
<<
"Mat of CV_32FC2"
;
else
cout
<<
"vector <Point2f>"
;
...
...
@@ -169,7 +136,7 @@ void CV_HomographyTest::print_information_2(int j, int N, int _method, const Mat
cout
<<
"Maximum allowed difference: "
<<
max_diff
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_3
(
int
_method
,
int
j
,
int
N
,
const
Mat
&
mask
)
static
void
print_information_3
(
int
_method
,
int
j
,
int
N
,
const
Mat
&
mask
)
{
cout
<<
endl
;
cout
<<
"Checking for inliers/outliers mask..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Type of srcPoints: "
;
if
((
j
>-
1
)
&&
(
j
<
2
))
cout
<<
"Mat of CV_32FC2"
;
else
cout
<<
"vector <Point2f>"
;
...
...
@@ -181,7 +148,7 @@ void CV_HomographyTest::print_information_3(int _method, int j, int N, const Mat
cout
<<
"Number of rows: "
<<
mask
.
rows
<<
" Number of cols: "
<<
mask
.
cols
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_4
(
int
_method
,
int
j
,
int
N
,
int
k
,
int
l
,
double
diff
)
static
void
print_information_4
(
int
_method
,
int
j
,
int
N
,
int
k
,
int
l
,
double
diff
)
{
cout
<<
endl
;
cout
<<
"Checking for accuracy of reprojection error computing..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Method: "
;
if
(
_method
==
0
)
cout
<<
0
<<
endl
;
else
cout
<<
"CV_LMEDS"
<<
endl
;
...
...
@@ -195,7 +162,7 @@ void CV_HomographyTest::print_information_4(int _method, int j, int N, int k, in
cout
<<
"Maximum allowed difference: "
<<
max_2diff
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_5
(
int
_method
,
int
j
,
int
N
,
int
l
,
double
diff
)
static
void
print_information_5
(
int
_method
,
int
j
,
int
N
,
int
l
,
double
diff
)
{
cout
<<
endl
;
cout
<<
"Checking for accuracy of reprojection error computing..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Method: "
;
if
(
_method
==
0
)
cout
<<
0
<<
endl
;
else
cout
<<
"CV_LMEDS"
<<
endl
;
...
...
@@ -208,7 +175,7 @@ void CV_HomographyTest::print_information_5(int _method, int j, int N, int l, do
cout
<<
"Maximum allowed difference: "
<<
max_diff
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_6
(
int
_method
,
int
j
,
int
N
,
int
k
,
double
diff
,
bool
value
)
static
void
print_information_6
(
int
_method
,
int
j
,
int
N
,
int
k
,
double
diff
,
bool
value
)
{
cout
<<
endl
;
cout
<<
"Checking for inliers/outliers mask..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Method: "
;
if
(
_method
==
RANSAC
)
cout
<<
"RANSAC"
<<
endl
;
else
if
(
_method
==
cv
::
RHO
)
cout
<<
"RHO"
<<
endl
;
else
cout
<<
_method
<<
endl
;
...
...
@@ -221,7 +188,7 @@ void CV_HomographyTest::print_information_6(int _method, int j, int N, int k, do
cout
<<
"Value of found mask: "
<<
value
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_7
(
int
_method
,
int
j
,
int
N
,
int
k
,
double
diff
,
bool
original_value
,
bool
found_value
)
static
void
print_information_7
(
int
_method
,
int
j
,
int
N
,
int
k
,
double
diff
,
bool
original_value
,
bool
found_value
)
{
cout
<<
endl
;
cout
<<
"Checking for inliers/outliers mask..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Method: "
;
if
(
_method
==
RANSAC
)
cout
<<
"RANSAC"
<<
endl
;
else
if
(
_method
==
cv
::
RHO
)
cout
<<
"RHO"
<<
endl
;
else
cout
<<
_method
<<
endl
;
...
...
@@ -234,7 +201,7 @@ void CV_HomographyTest::print_information_7(int _method, int j, int N, int k, do
cout
<<
"Value of original mask: "
<<
original_value
<<
" Value of found mask: "
<<
found_value
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
print_information_8
(
int
_method
,
int
j
,
int
N
,
int
k
,
int
l
,
double
diff
)
static
void
print_information_8
(
int
_method
,
int
j
,
int
N
,
int
k
,
int
l
,
double
diff
)
{
cout
<<
endl
;
cout
<<
"Checking for reprojection error of inlier..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Method: "
;
if
(
_method
==
RANSAC
)
cout
<<
"RANSAC"
<<
endl
;
else
if
(
_method
==
cv
::
RHO
)
cout
<<
"RHO"
<<
endl
;
else
cout
<<
_method
<<
endl
;
...
...
@@ -248,11 +215,15 @@ void CV_HomographyTest::print_information_8(int _method, int j, int N, int k, in
cout
<<
"Maximum allowed difference: "
<<
max_2diff
<<
endl
;
cout
<<
endl
;
}
void
CV_HomographyTest
::
run
(
int
)
}
// HomographyTestUtils::
TEST
(
Calib3d_Homography
,
accuracy
)
{
using
namespace
HomographyTestUtils
;
for
(
int
N
=
MIN_COUNT_OF_POINTS
;
N
<=
MAX_COUNT_OF_POINTS
;
++
N
)
{
RNG
&
rng
=
ts
->
get_rng
();
RNG
&
rng
=
cv
::
theRNG
();
float
*
src_data
=
new
float
[
2
*
N
];
...
...
@@ -308,7 +279,7 @@ void CV_HomographyTest::run(int)
for
(
int
i
=
0
;
i
<
METHODS_COUNT
;
++
i
)
{
method
=
METHOD
[
i
];
const
int
method
=
METHOD
[
i
];
switch
(
method
)
{
case
0
:
...
...
@@ -411,7 +382,7 @@ void CV_HomographyTest::run(int)
for
(
int
i
=
0
;
i
<
METHODS_COUNT
;
++
i
)
{
method
=
METHOD
[
i
];
const
int
method
=
METHOD
[
i
];
switch
(
method
)
{
case
0
:
...
...
@@ -573,8 +544,6 @@ void CV_HomographyTest::run(int)
}
}
TEST
(
Calib3d_Homography
,
accuracy
)
{
CV_HomographyTest
test
;
test
.
safe_run
();
}
TEST
(
Calib3d_Homography
,
EKcase
)
{
float
pt1data
[]
=
...
...
modules/imgproc/test/test_color.cpp
浏览文件 @
17e860a2
...
...
@@ -1077,7 +1077,7 @@ double CV_ColorLabTest::get_success_error_level( int /*test_case_idx*/, int i, i
{
int
depth
=
test_mat
[
i
][
j
].
depth
();
// j == 0 is for forward code, j == 1 is for inverse code
return
(
depth
==
CV_8U
)
?
(
srgb
?
3
2
:
8
)
:
return
(
depth
==
CV_8U
)
?
(
srgb
?
3
7
:
8
)
:
//(depth == CV_16U) ? 32 : // 16u is disabled
srgb
?
((
j
==
0
)
?
0.4
:
0.0055
)
:
1e-3
;
}
...
...
@@ -1256,7 +1256,7 @@ double CV_ColorLuvTest::get_success_error_level( int /*test_case_idx*/, int i, i
{
int
depth
=
test_mat
[
i
][
j
].
depth
();
// j == 0 is for forward code, j == 1 is for inverse code
return
(
depth
==
CV_8U
)
?
(
srgb
?
3
6
:
8
)
:
return
(
depth
==
CV_8U
)
?
(
srgb
?
3
7
:
8
)
:
//(depth == CV_16U) ? 32 : // 16u is disabled
5e-2
;
}
...
...
modules/imgproc/test/test_convhull.cpp
浏览文件 @
17e860a2
...
...
@@ -180,7 +180,7 @@ cvTsIsPointOnLineSegment(const cv::Point2f &x, const cv::Point2f &a, const cv::P
double
d2
=
cvTsDist
(
cvPoint2D32f
(
x
.
x
,
x
.
y
),
cvPoint2D32f
(
b
.
x
,
b
.
y
));
double
d3
=
cvTsDist
(
cvPoint2D32f
(
a
.
x
,
a
.
y
),
cvPoint2D32f
(
b
.
x
,
b
.
y
));
return
(
abs
(
d1
+
d2
-
d3
)
<=
(
1E-
5
));
return
(
abs
(
d1
+
d2
-
d3
)
<=
(
1E-
4
));
}
...
...
modules/imgproc/test/test_imgwarp.cpp
浏览文件 @
17e860a2
...
...
@@ -102,7 +102,6 @@ void CV_ImgWarpBaseTest::get_test_array_types_and_sizes( int test_case_idx,
int
cn
=
cvtest
::
randInt
(
rng
)
%
3
+
1
;
cvtest
::
ArrayTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
depth
=
depth
==
0
?
CV_8U
:
depth
==
1
?
CV_16U
:
CV_32F
;
cn
+=
cn
==
2
;
types
[
INPUT
][
0
]
=
types
[
INPUT_OUTPUT
][
0
]
=
types
[
REF_INPUT_OUTPUT
][
0
]
=
CV_MAKETYPE
(
depth
,
cn
);
if
(
test_array
[
INPUT
].
size
()
>
1
)
...
...
modules/imgproc/test/test_imgwarp_strict.cpp
浏览文件 @
17e860a2
...
...
@@ -151,8 +151,6 @@ void CV_ImageWarpBaseTest::generate_test_data()
depth
=
rng
.
uniform
(
0
,
CV_64F
);
int
cn
=
rng
.
uniform
(
1
,
4
);
while
(
cn
==
2
)
cn
=
rng
.
uniform
(
1
,
4
);
src
.
create
(
ssize
,
CV_MAKE_TYPE
(
depth
,
cn
));
...
...
@@ -237,7 +235,7 @@ float CV_ImageWarpBaseTest::get_success_error_level(int _interpolation, int) con
else
if
(
_interpolation
==
INTER_LANCZOS4
)
return
1.0
f
;
else
if
(
_interpolation
==
INTER_NEAREST
)
return
1.0
f
;
return
255.0
f
;
// FIXIT: check is not reliable for Black/White (0/255) images
else
if
(
_interpolation
==
INTER_AREA
)
return
2.0
f
;
else
...
...
@@ -430,8 +428,6 @@ void CV_Resize_Test::generate_test_data()
depth
=
rng
.
uniform
(
0
,
CV_64F
);
int
cn
=
rng
.
uniform
(
1
,
4
);
while
(
cn
==
2
)
cn
=
rng
.
uniform
(
1
,
4
);
src
.
create
(
ssize
,
CV_MAKE_TYPE
(
depth
,
cn
));
...
...
modules/ts/src/ts.cpp
浏览文件 @
17e860a2
...
...
@@ -621,20 +621,27 @@ void TS::set_gtest_status()
void
TS
::
update_context
(
BaseTest
*
test
,
int
test_case_idx
,
bool
update_ts_context
)
{
CV_UNUSED
(
update_ts_context
);
if
(
current_test_info
.
test
!=
test
)
{
for
(
int
i
=
0
;
i
<=
CONSOLE_IDX
;
i
++
)
output_buf
[
i
]
=
string
();
rng
=
RNG
(
params
.
rng_seed
);
current_test_info
.
rng_seed0
=
current_test_info
.
rng_seed
=
rng
.
state
;
}
if
(
test_case_idx
>=
0
)
{
current_test_info
.
rng_seed
=
param_seed
+
test_case_idx
;
current_test_info
.
rng_seed0
=
current_test_info
.
rng_seed
;
rng
=
RNG
(
current_test_info
.
rng_seed
);
cv
::
theRNG
()
=
rng
;
}
current_test_info
.
test
=
test
;
current_test_info
.
test_case_idx
=
test_case_idx
;
current_test_info
.
code
=
0
;
cvSetErrStatus
(
CV_StsOk
);
if
(
update_ts_context
)
current_test_info
.
rng_seed
=
rng
.
state
;
}
...
...
modules/video/test/test_estimaterigid.cpp
浏览文件 @
17e860a2
...
...
@@ -74,7 +74,7 @@ struct WrapAff2D
bool
CV_RigidTransform_Test
::
testNPoints
(
int
from
)
{
cv
::
RNG
rng
=
ts
->
get_rng
();
cv
::
RNG
rng
=
cv
::
theRNG
();
int
progress
=
0
;
int
k
,
ntests
=
10000
;
...
...
@@ -172,4 +172,4 @@ void CV_RigidTransform_Test::run( int start_from )
TEST
(
Video_RigidFlow
,
accuracy
)
{
CV_RigidTransform_Test
test
;
test
.
safe_run
();
}
}}
// namespace
\ No newline at end of file
}}
// namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录