Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
f50b58b5
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,发现更多精彩内容 >>
提交
f50b58b5
编写于
10月 25, 2018
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12854 from allnes:detect_qr_code
上级
223d7cfb
d305fd4f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
108 addition
and
1 deletion
+108
-1
modules/objdetect/perf/perf_qrcode_pipeline.cpp
modules/objdetect/perf/perf_qrcode_pipeline.cpp
+106
-0
modules/objdetect/test/test_qrcode.cpp
modules/objdetect/test/test_qrcode.cpp
+2
-1
未找到文件。
modules/objdetect/perf/perf_qrcode_pipeline.cpp
0 → 100644
浏览文件 @
f50b58b5
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "perf_precomp.hpp"
namespace
opencv_test
{
namespace
{
typedef
::
perf
::
TestBaseWithParam
<
std
::
string
>
Perf_Objdetect_QRCode
;
PERF_TEST_P_
(
Perf_Objdetect_QRCode
,
detect
)
{
const
std
::
string
name_current_image
=
GetParam
();
const
std
::
string
root
=
"cv/qrcode/"
;
std
::
string
image_path
=
findDataFile
(
root
+
name_current_image
);
Mat
src
=
imread
(
image_path
,
IMREAD_GRAYSCALE
),
straight_barcode
;
ASSERT_FALSE
(
src
.
empty
())
<<
"Can't read image: "
<<
image_path
;
std
::
vector
<
Point
>
corners
;
TEST_CYCLE
()
ASSERT_TRUE
(
detectQRCode
(
src
,
corners
));
SANITY_CHECK
(
corners
);
}
#ifdef HAVE_QUIRC
PERF_TEST_P_
(
Perf_Objdetect_QRCode
,
decode
)
{
const
std
::
string
name_current_image
=
GetParam
();
const
std
::
string
root
=
"cv/qrcode/"
;
std
::
string
image_path
=
findDataFile
(
root
+
name_current_image
);
Mat
src
=
imread
(
image_path
,
IMREAD_GRAYSCALE
),
straight_barcode
;
ASSERT_FALSE
(
src
.
empty
())
<<
"Can't read image: "
<<
image_path
;
std
::
vector
<
Point
>
corners
;
std
::
string
decoded_info
;
ASSERT_TRUE
(
detectQRCode
(
src
,
corners
));
TEST_CYCLE
()
ASSERT_TRUE
(
decodeQRCode
(
src
,
corners
,
decoded_info
,
straight_barcode
));
std
::
vector
<
uint8_t
>
decoded_info_uint8_t
(
decoded_info
.
begin
(),
decoded_info
.
end
());
SANITY_CHECK
(
decoded_info_uint8_t
);
SANITY_CHECK
(
straight_barcode
);
}
#endif
INSTANTIATE_TEST_CASE_P
(
/*nothing*/
,
Perf_Objdetect_QRCode
,
::
testing
::
Values
(
"version_1_down.jpg"
,
"version_1_left.jpg"
,
"version_1_right.jpg"
,
"version_1_up.jpg"
,
"version_1_top.jpg"
,
"version_5_down.jpg"
,
"version_5_left.jpg"
,
"version_5_right.jpg"
,
"version_5_up.jpg"
,
"version_5_top.jpg"
,
"russian.jpg"
,
"kanji.jpg"
,
"link_github_ocv.jpg"
,
"link_ocv.jpg"
,
"link_wiki_cv.jpg"
)
);
typedef
::
perf
::
TestBaseWithParam
<
tuple
<
std
::
string
,
Size
>
>
Perf_Objdetect_Not_QRCode
;
PERF_TEST_P_
(
Perf_Objdetect_Not_QRCode
,
detect
)
{
std
::
vector
<
Point
>
corners
;
std
::
string
type_gen
=
get
<
0
>
(
GetParam
());
Size
resolution
=
get
<
1
>
(
GetParam
());
Mat
not_qr_code
(
resolution
,
CV_8UC1
,
Scalar
(
0
));
if
(
type_gen
==
"random"
)
{
RNG
rng
;
rng
.
fill
(
not_qr_code
,
RNG
::
UNIFORM
,
Scalar
(
0
),
Scalar
(
1
));
}
TEST_CYCLE
()
ASSERT_FALSE
(
detectQRCode
(
not_qr_code
,
corners
));
SANITY_CHECK_NOTHING
();
}
#ifdef HAVE_QUIRC
PERF_TEST_P_
(
Perf_Objdetect_Not_QRCode
,
decode
)
{
Mat
straight_barcode
;
std
::
string
decoded_info
;
std
::
vector
<
Point
>
corners
;
corners
.
push_back
(
Point
(
0
,
0
));
corners
.
push_back
(
Point
(
0
,
5
));
corners
.
push_back
(
Point
(
10
,
0
));
corners
.
push_back
(
Point
(
15
,
15
));
std
::
string
type_gen
=
get
<
0
>
(
GetParam
());
Size
resolution
=
get
<
1
>
(
GetParam
());
Mat
not_qr_code
(
resolution
,
CV_8UC1
,
Scalar
(
0
));
if
(
type_gen
==
"random"
)
{
RNG
rng
;
rng
.
fill
(
not_qr_code
,
RNG
::
UNIFORM
,
Scalar
(
0
),
Scalar
(
1
));
}
TEST_CYCLE
()
ASSERT_FALSE
(
decodeQRCode
(
not_qr_code
,
corners
,
decoded_info
,
straight_barcode
));
SANITY_CHECK_NOTHING
();
}
#endif
INSTANTIATE_TEST_CASE_P
(
/*nothing*/
,
Perf_Objdetect_Not_QRCode
,
::
testing
::
Combine
(
::
testing
::
Values
(
"zero"
,
"random"
),
::
testing
::
Values
(
Size
(
640
,
480
),
Size
(
1280
,
720
),
Size
(
1920
,
1080
))
));
}
}
// namespace
modules/objdetect/test/test_qrcode.cpp
浏览文件 @
f50b58b5
...
...
@@ -115,7 +115,8 @@ INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode, testing::ValuesIn(qrcode_images_
TEST
(
Objdetect_QRCode_basic
,
not_found_qrcode
)
{
std
::
vector
<
Point
>
corners
,
straight_barcode
;
std
::
vector
<
Point
>
corners
;
Mat
straight_barcode
;
std
::
string
decoded_info
;
Mat
zero_image
=
Mat
::
zeros
(
256
,
256
,
CV_8UC1
);
EXPECT_FALSE
(
detectQRCode
(
zero_image
,
corners
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录