Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e9e8bf4b
Commit
e9e8bf4b
authored
Nov 20, 2018
by
Vitaly Tuzov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added performance tests for findContours
parent
e1a2c034
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
perf_contours.cpp
modules/imgproc/perf/perf_contours.cpp
+87
-0
No files found.
modules/imgproc/perf/perf_contours.cpp
0 → 100644
View file @
e9e8bf4b
// 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
{
CV_ENUM
(
RetrMode
,
RETR_EXTERNAL
,
RETR_LIST
,
RETR_CCOMP
,
RETR_TREE
)
CV_ENUM
(
ApproxMode
,
CHAIN_APPROX_NONE
,
CHAIN_APPROX_SIMPLE
,
CHAIN_APPROX_TC89_L1
,
CHAIN_APPROX_TC89_KCOS
)
typedef
TestBaseWithParam
<
tuple
<
Size
,
RetrMode
,
ApproxMode
,
int
>
>
TestFindContours
;
PERF_TEST_P
(
TestFindContours
,
findContours
,
Combine
(
Values
(
szVGA
,
sz1080p
),
// image size
RetrMode
::
all
(),
// retrieval mode
ApproxMode
::
all
(),
// approximation method
Values
(
32
,
128
)
// blob count
)
)
{
Size
img_size
=
get
<
0
>
(
GetParam
());
int
retr_mode
=
get
<
1
>
(
GetParam
());
int
approx_method
=
get
<
2
>
(
GetParam
());
int
blob_count
=
get
<
3
>
(
GetParam
());
RNG
rng
;
Mat
img
=
Mat
::
zeros
(
img_size
,
CV_8UC1
);
for
(
int
i
=
0
;
i
<
blob_count
;
i
++
)
{
Point
center
;
center
.
x
=
(
unsigned
)
rng
%
(
img
.
cols
-
2
);
center
.
y
=
(
unsigned
)
rng
%
(
img
.
rows
-
2
);
Size
axes
;
axes
.
width
=
((
unsigned
)
rng
%
49
+
2
)
/
2
;
axes
.
height
=
((
unsigned
)
rng
%
49
+
2
)
/
2
;
double
angle
=
(
unsigned
)
rng
%
180
;
int
brightness
=
(
unsigned
)
rng
%
2
;
// keep the border clear
ellipse
(
img
(
Rect
(
1
,
1
,
img
.
cols
-
2
,
img
.
rows
-
2
)),
Point
(
center
),
Size
(
axes
),
angle
,
0.
,
360.
,
Scalar
(
brightness
),
-
1
);
}
vector
<
vector
<
Point
>
>
contours
;
TEST_CYCLE
()
findContours
(
img
,
contours
,
retr_mode
,
approx_method
);
SANITY_CHECK_NOTHING
();
}
typedef
TestBaseWithParam
<
tuple
<
Size
,
ApproxMode
,
int
>
>
TestFindContoursFF
;
PERF_TEST_P
(
TestFindContoursFF
,
findContours
,
Combine
(
Values
(
szVGA
,
sz1080p
),
// image size
ApproxMode
::
all
(),
// approximation method
Values
(
32
,
128
)
// blob count
)
)
{
Size
img_size
=
get
<
0
>
(
GetParam
());
int
approx_method
=
get
<
1
>
(
GetParam
());
int
blob_count
=
get
<
2
>
(
GetParam
());
RNG
rng
;
Mat
img
=
Mat
::
zeros
(
img_size
,
CV_32SC1
);
for
(
int
i
=
0
;
i
<
blob_count
;
i
++
)
{
Point
center
;
center
.
x
=
(
unsigned
)
rng
%
(
img
.
cols
-
2
);
center
.
y
=
(
unsigned
)
rng
%
(
img
.
rows
-
2
);
Size
axes
;
axes
.
width
=
((
unsigned
)
rng
%
49
+
2
)
/
2
;
axes
.
height
=
((
unsigned
)
rng
%
49
+
2
)
/
2
;
double
angle
=
(
unsigned
)
rng
%
180
;
int
brightness
=
(
unsigned
)
rng
%
2
;
// keep the border clear
ellipse
(
img
(
Rect
(
1
,
1
,
img
.
cols
-
2
,
img
.
rows
-
2
)),
Point
(
center
),
Size
(
axes
),
angle
,
0.
,
360.
,
Scalar
(
brightness
),
-
1
);
}
vector
<
vector
<
Point
>
>
contours
;
TEST_CYCLE
()
findContours
(
img
,
contours
,
RETR_FLOODFILL
,
approx_method
);
SANITY_CHECK_NOTHING
();
}
}
// namespace
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment