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
6b888ada
Commit
6b888ada
authored
Jul 28, 2011
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API tests are added: fillConvexPoly, mixChannels, drawContours
parent
8c328a9e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
6 deletions
+87
-6
coreTest.java
.../java/android_test/src/org/opencv/test/core/coreTest.java
+78
-5
imgprocTest.java
...android_test/src/org/opencv/test/imgproc/imgprocTest.java
+9
-1
No files found.
modules/java/android_test/src/org/opencv/test/core/coreTest.java
View file @
6b888ada
package
org
.
opencv
.
test
.
core
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.Converters
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvException
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Rect
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Core
;
import
org.opencv.test.OpenCVTestCase
;
public
class
coreTest
extends
OpenCVTestCase
{
...
...
@@ -478,15 +480,57 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testFillConvexPolyMatMatScalar
()
{
fail
(
"Not yet implemented"
);
List
<
Point
>
lp
=
new
ArrayList
<
Point
>(
4
);
lp
.
add
(
new
Point
(
1
,
1
)
);
lp
.
add
(
new
Point
(
5
,
0
)
);
lp
.
add
(
new
Point
(
6
,
8
)
);
lp
.
add
(
new
Point
(
0
,
9
)
);
Mat
points
=
Converters
.
vector_Point_to_Mat
(
lp
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
fillConvexPoly
(
gray0
,
points
,
new
Scalar
(
150
));
assertTrue
(
0
<
Core
.
countNonZero
(
gray0
));
Core
.
fillConvexPoly
(
gray0
,
points
,
new
Scalar
(
0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
}
public
void
testFillConvexPolyMatMatScalarInt
()
{
fail
(
"Not yet implemented"
);
List
<
Point
>
lp
=
new
ArrayList
<
Point
>(
4
);
lp
.
add
(
new
Point
(
1
,
1
)
);
lp
.
add
(
new
Point
(
5
,
0
)
);
lp
.
add
(
new
Point
(
6
,
8
)
);
lp
.
add
(
new
Point
(
0
,
9
)
);
Mat
points
=
Converters
.
vector_Point_to_Mat
(
lp
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
fillConvexPoly
(
gray0
,
points
,
new
Scalar
(
150
),
4
);
assertTrue
(
0
<
Core
.
countNonZero
(
gray0
));
Core
.
fillConvexPoly
(
gray0
,
points
,
new
Scalar
(
0
),
4
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
}
public
void
testFillConvexPolyMatMatScalarIntInt
()
{
fail
(
"Not yet implemented"
);
List
<
Point
>
lp
=
new
ArrayList
<
Point
>(
4
);
lp
.
add
(
new
Point
(
1
,
1
)
);
lp
.
add
(
new
Point
(
5
,
1
)
);
lp
.
add
(
new
Point
(
5
,
8
)
);
lp
.
add
(
new
Point
(
1
,
8
)
);
Mat
points
=
Converters
.
vector_Point_to_Mat
(
lp
);
List
<
Point
>
lp2
=
new
ArrayList
<
Point
>(
4
);
lp2
.
add
(
new
Point
(
2
,
2
)
);
lp2
.
add
(
new
Point
(
10
,
2
)
);
lp2
.
add
(
new
Point
(
10
,
17
)
);
//TODO: don't know why '16' fails the test
lp2
.
add
(
new
Point
(
2
,
17
)
);
//TODO: don't know why '16' fails the test
Mat
points2
=
Converters
.
vector_Point_to_Mat
(
lp2
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
fillConvexPoly
(
gray0
,
points
,
new
Scalar
(
150
),
4
,
0
);
assertTrue
(
0
<
Core
.
countNonZero
(
gray0
));
Core
.
fillConvexPoly
(
gray0
,
points2
,
new
Scalar
(
0
),
4
,
1
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
}
public
void
testFillPolyMatListOfMatScalar
()
{
...
...
@@ -921,7 +965,36 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testMixChannels
()
{
fail
(
"Not yet implemented"
);
rgba0
.
setTo
(
new
Scalar
(
10
,
20
,
30
,
40
));
List
<
Mat
>
result
=
new
ArrayList
<
Mat
>();
Core
.
split
(
rgba0
,
result
);
assertEquals
(
10
,
(
int
)
result
.
get
(
0
).
get
(
0
,
0
)[
0
]);
assertEquals
(
20
,
(
int
)
result
.
get
(
1
).
get
(
0
,
0
)[
0
]);
assertEquals
(
30
,
(
int
)
result
.
get
(
2
).
get
(
0
,
0
)[
0
]);
assertEquals
(
40
,
(
int
)
result
.
get
(
3
).
get
(
0
,
0
)[
0
]);
List
<
Mat
>
src
=
new
ArrayList
<
Mat
>(
1
);
src
.
add
(
rgba0
);
List
<
Mat
>
dst
=
new
ArrayList
<
Mat
>(
4
);
dst
.
add
(
gray3
);
dst
.
add
(
gray2
);
dst
.
add
(
gray1
);
dst
.
add
(
gray0
);
List
<
Integer
>
fromTo
=
new
ArrayList
<
Integer
>(
8
);
fromTo
.
add
(
0
);
fromTo
.
add
(
3
);
fromTo
.
add
(
1
);
fromTo
.
add
(
2
);
fromTo
.
add
(
2
);
fromTo
.
add
(
1
);
fromTo
.
add
(
3
);
fromTo
.
add
(
0
);
Core
.
mixChannels
(
src
,
dst
,
fromTo
);
assertMatEqual
(
result
.
get
(
0
),
gray0
);
assertMatEqual
(
result
.
get
(
1
),
gray1
);
assertMatEqual
(
result
.
get
(
2
),
gray2
);
assertMatEqual
(
result
.
get
(
3
),
gray3
);
}
public
void
testMulSpectrumsMatMatMatInt
()
{
...
...
modules/java/android_test/src/org/opencv/test/imgproc/imgprocTest.java
View file @
6b888ada
...
...
@@ -588,7 +588,15 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testDrawContoursMatListOfMatIntScalar
()
{
fail
(
"Not yet implemented"
);
List
<
Mat
>
contours
=
new
ArrayList
<
Mat
>(
5
);
Mat
hierarchy
=
dst
;
Core
.
rectangle
(
gray0
,
new
Point
(
1
,
2
),
new
Point
(
7
,
8
),
new
Scalar
(
100
));
Imgproc
.
findContours
(
gray0
,
contours
,
hierarchy
,
Imgproc
.
RETR_EXTERNAL
,
Imgproc
.
CHAIN_APPROX_SIMPLE
);
assertTrue
(
1
==
contours
.
size
());
assertFalse
(
0
==
Core
.
countNonZero
(
gray0
));
Imgproc
.
drawContours
(
gray0
,
contours
,
-
1
,
new
Scalar
(
0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
}
public
void
testDrawContoursMatListOfMatIntScalarInt
()
{
...
...
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