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
d1311518
Commit
d1311518
authored
Mar 27, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: test-sample for FIXED_TYPE demonstration
with implementation of functions with multiple output formats
parent
24acbecd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
test_misc.cpp
modules/core/test/test_misc.cpp
+46
-0
No files found.
modules/core/test/test_misc.cpp
View file @
d1311518
...
...
@@ -133,6 +133,52 @@ TEST(Core_OutputArrayAssign, _Matxf_UMatd)
}
int
fixedType_handler
(
OutputArray
dst
)
{
int
type
=
CV_32FC2
;
// return points only {x, y}
if
(
dst
.
fixedType
())
{
type
=
dst
.
type
();
CV_Assert
(
type
==
CV_32FC2
||
type
==
CV_32FC3
);
// allow points + confidence level: {x, y, confidence}
}
const
int
N
=
100
;
dst
.
create
(
Size
(
1
,
N
),
type
);
Mat
m
=
dst
.
getMat
();
if
(
m
.
type
()
==
CV_32FC2
)
{
for
(
int
i
=
0
;
i
<
N
;
i
++
)
m
.
at
<
Vec2f
>
(
i
)
=
Vec2f
((
float
)
i
,
(
float
)(
i
*
2
));
}
else
if
(
m
.
type
()
==
CV_32FC3
)
{
for
(
int
i
=
0
;
i
<
N
;
i
++
)
m
.
at
<
Vec3f
>
(
i
)
=
Vec3f
((
float
)
i
,
(
float
)(
i
*
2
),
1.0
f
/
(
i
+
1
));
}
else
{
CV_Assert
(
0
&&
"Internal error"
);
}
return
CV_MAT_CN
(
type
);
}
TEST
(
Core_OutputArray
,
FixedType
)
{
Mat_
<
Vec2f
>
pointsOnly
;
int
num_pointsOnly
=
fixedType_handler
(
pointsOnly
);
EXPECT_EQ
(
2
,
num_pointsOnly
);
Mat_
<
Vec3f
>
pointsWithConfidence
;
int
num_pointsWithConfidence
=
fixedType_handler
(
pointsWithConfidence
);
EXPECT_EQ
(
3
,
num_pointsWithConfidence
);
Mat
defaultResult
;
int
num_defaultResult
=
fixedType_handler
(
defaultResult
);
EXPECT_EQ
(
2
,
num_defaultResult
);
}
TEST
(
Core_String
,
find_last_of__with__empty_string
)
{
cv
::
String
s
;
...
...
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