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
9fbd47ff
Commit
9fbd47ff
authored
Jun 30, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added several tests for java/core module
parent
5d703abd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
7 deletions
+59
-7
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+20
-0
coreTest.java
modules/java/android_test/src/org/opencv/test/coreTest.java
+39
-7
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
9fbd47ff
...
@@ -18,6 +18,15 @@ public class OpenCVTestCase extends AndroidTestCase {
...
@@ -18,6 +18,15 @@ public class OpenCVTestCase extends AndroidTestCase {
static
Mat
gray127
;
static
Mat
gray127
;
static
Mat
gray128
;
static
Mat
gray128
;
static
Mat
gray255
;
static
Mat
gray255
;
static
Mat
grayRnd
;
static
Mat
grayRnd_32f
;
static
Mat
gray0_32f
;
static
Mat
gray0_32f_1d
;
static
Mat
gray0_64f
;
static
Mat
gray0_64f_1d
;
static
Mat
dst
;
static
Mat
dst
;
...
@@ -33,6 +42,17 @@ public class OpenCVTestCase extends AndroidTestCase {
...
@@ -33,6 +42,17 @@ public class OpenCVTestCase extends AndroidTestCase {
gray127
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray127
.
setTo
(
127.0
);
gray127
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray127
.
setTo
(
127.0
);
gray128
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray128
.
setTo
(
128.0
);
gray128
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray128
.
setTo
(
128.0
);
gray255
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray255
.
setTo
(
256.0
);
gray255
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray255
.
setTo
(
256.0
);
Mat
low
=
new
Mat
(
1
,
1
,
Mat
.
CvType
.
CV_16UC1
);
low
.
setTo
(
0
);
Mat
high
=
new
Mat
(
1
,
1
,
Mat
.
CvType
.
CV_16UC1
);
high
.
setTo
(
256
);
grayRnd
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
core
.
randu
(
grayRnd
,
low
,
high
);
grayRnd_32f
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
randu
(
grayRnd_32f
,
low
,
high
);
gray0_32f
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
gray0_32f
.
setTo
(
0.0
);
gray0_32f_1d
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
gray0_32f_1d
.
setTo
(
0.0
);
gray0_64f
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
gray0_64f
.
setTo
(
0.0
);
gray0_64f_1d
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
gray0_64f_1d
.
setTo
(
0.0
);
dst
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_8UC1
);
dst
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_8UC1
);
assertTrue
(
dst
.
empty
());
assertTrue
(
dst
.
empty
());
...
...
modules/java/android_test/src/org/opencv/test/coreTest.java
View file @
9fbd47ff
package
org
.
opencv
.
test
;
package
org
.
opencv
.
test
;
import
org.opencv.Mat
;
import
org.opencv.core
;
import
org.opencv.core
;
public
class
coreTest
extends
OpenCVTestCase
{
public
class
coreTest
extends
OpenCVTestCase
{
...
@@ -13,11 +14,32 @@ public class coreTest extends OpenCVTestCase {
...
@@ -13,11 +14,32 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testLUTMatMatMat
()
{
public
void
testLUTMatMatMat
()
{
fail
(
"Not yet implemented"
);
Mat
lut
=
new
Mat
(
1
,
256
,
Mat
.
CvType
.
CV_8UC1
);
}
lut
.
setTo
(
0
);
public
void
testMahalanobis
()
{
core
.
LUT
(
grayRnd
,
lut
,
dst
);
fail
(
"Not yet implemented"
);
assertMatEqual
(
gray0
,
dst
);
lut
.
setTo
(
255
);
core
.
LUT
(
grayRnd
,
lut
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
covar
.
inv
();
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
Mat
line2
=
grayRnd_32f
.
submat
(
1
,
2
,
0
,
grayRnd_32f
.
cols
());
double
d
=
0.0
;
d
=
core
.
Mahalanobis
(
line1
,
line1
,
covar
);
assertEquals
(
0.0
,
d
);
d
=
core
.
Mahalanobis
(
line1
,
line2
,
covar
);
assertTrue
(
d
>
0.0
);
}
}
public
void
testAbsdiff
()
{
public
void
testAbsdiff
()
{
...
@@ -80,11 +102,21 @@ public class coreTest extends OpenCVTestCase {
...
@@ -80,11 +102,21 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testCalcCovarMatrixMatMatMatIntInt
()
{
public
void
testCalcCovarMatrixMatMatMatIntInt
()
{
fail
(
"Not yet implemented"
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
assertMatEqual
(
gray0_32f
,
covar
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
}
}
public
void
testCalcCovarMatrixMatMatMatInt
()
{
public
void
testCalcCovarMatrixMatMatMatInt
()
{
fail
(
"Not yet implemented"
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
);
//FIXME: CV_COVAR_NORMAL
assertMatEqual
(
gray0_64f
,
covar
);
assertMatEqual
(
gray0_64f_1d
,
mean
);
}
}
public
void
testCartToPolarMatMatMatMatBoolean
()
{
public
void
testCartToPolarMatMatMatMatBoolean
()
{
...
...
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