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
b58dc210
Commit
b58dc210
authored
Jul 12, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java tests: added 2 tests for calib3d, implemented assertMatNotEqual
parent
63f8feb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+23
-1
calib3dTest.java
...android_test/src/org/opencv/test/calib3d/calib3dTest.java
+14
-3
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
b58dc210
...
...
@@ -30,7 +30,8 @@ public class OpenCVTestCase extends TestCase {
protected
static
Mat
gray255
;
protected
static
Mat
grayRnd
;
protected
static
Mat
gray_16u_256
;
protected
static
Mat
gray_16u_256
;
protected
static
Mat
gray_16s_1024
;
protected
static
Mat
gray0_32f
;
protected
static
Mat
gray1_32f
;
...
...
@@ -71,6 +72,7 @@ public class OpenCVTestCase extends TestCase {
gray255
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
gray255
.
setTo
(
new
Scalar
(
255.0
));
gray_16u_256
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16U
);
gray_16u_256
.
setTo
(
new
Scalar
(
256
));
gray_16s_1024
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16S
);
gray_16s_1024
.
setTo
(
new
Scalar
(
1024
));
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
...
...
@@ -119,6 +121,26 @@ public class OpenCVTestCase extends TestCase {
}
}
public
static
void
assertMatNotEqual
(
Mat
m1
,
Mat
m2
)
{
//TODO: copypasta (see above)
//OpenCVTestRunner.Log(m1.toString());
//OpenCVTestRunner.Log(m2.toString());
if
(!
m1
.
type
().
equals
(
m2
.
type
())
||
m1
.
cols
()
!=
m2
.
cols
()
||
m1
.
rows
()
!=
m2
.
rows
())
{
throw
new
UnsupportedOperationException
();
}
else
if
(
m1
.
channels
()
==
1
)
{
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
!=
0.0
);
}
else
{
for
(
int
coi
=
0
;
coi
<
m1
.
channels
();
coi
++)
{
Mat
m1c
=
getCOI
(
m1
,
coi
);
Mat
m2c
=
getCOI
(
m2
,
coi
);
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
!=
0.0
);
}
}
}
static
private
Mat
getCOI
(
Mat
m
,
int
coi
)
{
Mat
ch
=
new
Mat
(
m
.
rows
(),
m
.
cols
(),
m
.
depth
());
...
...
modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java
View file @
b58dc210
package
org
.
opencv
.
test
.
calib3d
;
import
org.opencv.Point
;
import
org.opencv.Scalar
;
import
org.opencv.Size
;
import
org.opencv.calib3d
;
import
org.opencv.core
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
public
class
calib3dTest
extends
OpenCVTestCase
{
...
...
@@ -88,7 +90,13 @@ public class calib3dTest extends OpenCVTestCase {
}
public
void
testFilterSpecklesMatDoubleIntDouble
()
{
fail
(
"Not yet implemented"
);
gray_16s_1024
.
copyTo
(
dst
);
Point
center
=
new
Point
(
gray_16s_1024
.
rows
()/
2
.,
gray_16s_1024
.
cols
()/
2
.);
core
.
circle
(
dst
,
center
,
1
,
Scalar
.
all
(
4096
));
assertMatNotEqual
(
gray_16s_1024
,
dst
);
calib3d
.
filterSpeckles
(
dst
,
1024.0
,
100
,
0
.);
assertMatEqual
(
gray_16s_1024
,
dst
);
}
public
void
testFilterSpecklesMatDoubleIntDoubleMat
()
{
...
...
@@ -102,7 +110,10 @@ public class calib3dTest extends OpenCVTestCase {
}
public
void
testFindChessboardCornersMatSizeMatInt
()
{
fail
(
"Not yet implemented"
);
//CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE + CALIB_CB_FAST_CHECK
Size
patternSize
=
new
Size
(
9
,
6
);
calib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
,
calib3d
.
CALIB_CB_ADAPTIVE_THRESH
+
calib3d
.
CALIB_CB_NORMALIZE_IMAGE
+
calib3d
.
CALIB_CB_FAST_CHECK
);
assertTrue
(!
dst
.
empty
());
}
public
void
testFindFundamentalMatMatMat
()
{
...
...
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