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
3f508941
Commit
3f508941
authored
Jul 28, 2011
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2 'findContours(...)' tests are added
parent
7c54ebfe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
imgprocTest.java
...android_test/src/org/opencv/test/imgproc/imgprocTest.java
+31
-4
No files found.
modules/java/android_test/src/org/opencv/test/imgproc/imgprocTest.java
View file @
3f508941
...
...
@@ -3,6 +3,7 @@ package org.opencv.test.imgproc;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
...
...
@@ -10,10 +11,8 @@ import org.opencv.core.Rect;
import
org.opencv.core.RotatedRect
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Size
;
import
org.opencv.core.Core
;
import
org.opencv.imgproc.Imgproc
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
public
class
imgprocTest
extends
OpenCVTestCase
{
...
...
@@ -715,11 +714,39 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testFindContoursMatListOfMatMatIntInt
()
{
fail
(
"Not yet implemented"
);
Mat
img
=
new
Mat
(
50
,
50
,
CvType
.
CV_8UC1
,
new
Scalar
(
0
));
List
<
Mat
>
contours
=
new
ArrayList
<
Mat
>(
5
);
Mat
hierarchy
=
dst
;
Imgproc
.
findContours
(
img
,
contours
,
hierarchy
,
Imgproc
.
RETR_EXTERNAL
,
Imgproc
.
CHAIN_APPROX_SIMPLE
);
// no contours on empty image
assertEquals
(
contours
.
size
(),
0
);
assertEquals
(
contours
.
size
(),
hierarchy
.
total
());
Core
.
rectangle
(
img
,
new
Point
(
10
,
20
),
new
Point
(
20
,
30
),
new
Scalar
(
100
),
3
,
16
/*CV_AA*/
);
Core
.
rectangle
(
img
,
new
Point
(
30
,
35
),
new
Point
(
40
,
45
),
new
Scalar
(
200
));
Imgproc
.
findContours
(
img
,
contours
,
hierarchy
,
Imgproc
.
RETR_EXTERNAL
,
Imgproc
.
CHAIN_APPROX_SIMPLE
);
// two contours of two rectangles
assertEquals
(
contours
.
size
(),
2
);
assertEquals
(
contours
.
size
(),
hierarchy
.
total
());
}
public
void
testFindContoursMatListOfMatMatIntIntPoint
()
{
fail
(
"Not yet implemented"
);
Mat
img
=
new
Mat
(
50
,
50
,
CvType
.
CV_8UC1
,
new
Scalar
(
0
));
Mat
img2
=
img
.
submat
(
5
,
50
,
3
,
50
);
List
<
Mat
>
contours
=
new
ArrayList
<
Mat
>();
List
<
Mat
>
contours2
=
new
ArrayList
<
Mat
>();
Mat
hierarchy
=
dst
;
Core
.
rectangle
(
img
,
new
Point
(
10
,
20
),
new
Point
(
20
,
30
),
new
Scalar
(
100
),
3
,
16
/*CV_AA*/
);
Core
.
rectangle
(
img
,
new
Point
(
30
,
35
),
new
Point
(
40
,
45
),
new
Scalar
(
200
));
Imgproc
.
findContours
(
img
,
contours
,
hierarchy
,
Imgproc
.
RETR_EXTERNAL
,
Imgproc
.
CHAIN_APPROX_SIMPLE
);
Imgproc
.
findContours
(
img2
,
contours2
,
hierarchy
,
Imgproc
.
RETR_EXTERNAL
,
Imgproc
.
CHAIN_APPROX_SIMPLE
,
new
Point
(
3
,
5
));
assertEquals
(
contours
.
size
(),
contours2
.
size
());
assertMatEqual
(
contours
.
get
(
0
),
contours2
.
get
(
0
));
}
public
void
testFitEllipse
()
{
...
...
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