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
039fd554
Commit
039fd554
authored
Jul 27, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added several Android tests
parent
26bd6b3f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
253 additions
and
140 deletions
+253
-140
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+30
-28
calib3dTest.java
...android_test/src/org/opencv/test/calib3d/calib3dTest.java
+98
-43
RectTest.java
.../java/android_test/src/org/opencv/test/core/RectTest.java
+17
-1
coreTest.java
.../java/android_test/src/org/opencv/test/core/coreTest.java
+108
-68
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
039fd554
...
...
@@ -8,7 +8,6 @@ import org.opencv.core.Scalar;
import
org.opencv.core.Core
;
import
org.opencv.highgui.Highgui
;
public
class
OpenCVTestCase
extends
TestCase
{
protected
static
int
matSize
=
10
;
...
...
@@ -17,12 +16,12 @@ public class OpenCVTestCase extends TestCase {
protected
static
Mat
dst
;
protected
static
Mat
truth
;
//Naming notation: <channels info>_[depth]_[dimensions]_value
//
examples: gray0
- single channel 8U 2d Mat filled with 0
//
Naming notation: <channels info>_[depth]_[dimensions]_value
//
examples: gray0
- single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d
//
TODO: OpenCVTestCase refactorings
//
TODO: OpenCVTestCase refactorings
// - rename matrices
// - create some masks
// - use truth member everywhere
...
...
@@ -81,19 +80,24 @@ public class OpenCVTestCase extends TestCase {
gray255
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
255
));
gray_16u_256
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16U
,
new
Scalar
(
256
));
gray_16s_1024
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16S
,
new
Scalar
(
1024
));
gray_16s_1024
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16S
,
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
));
grayRnd
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
Core
.
randu
(
grayRnd
,
low
,
high
);
grayRnd
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
Core
.
randu
(
grayRnd
,
low
,
high
);
gray0_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
0.0
));
gray1_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
1.0
));
gray3_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
3.0
));
gray9_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
9.0
));
gray255_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
255.0
));
grayE_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayE_32f
=
Mat
.
eye
(
matSize
,
matSize
,
CvType
.
CV_32FC1
);
grayRnd_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Core
.
randu
(
grayRnd_32f
,
low
,
high
);
gray255_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
255.0
));
grayE_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayE_32f
=
Mat
.
eye
(
matSize
,
matSize
,
CvType
.
CV_32FC1
);
grayRnd_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Core
.
randu
(
grayRnd_32f
,
low
,
high
);
gray0_32f_1d
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
0.0
));
...
...
@@ -106,8 +110,10 @@ public class OpenCVTestCase extends TestCase {
rgbLena
=
Highgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
grayChess
=
Highgui
.
imread
(
OpenCVTestRunner
.
CHESS_PATH
,
0
);
v1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v1
.
put
(
0
,
0
,
1.0
,
3.0
,
2.0
);
v2
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v2
.
put
(
0
,
0
,
2.0
,
1.0
,
3.0
);
v1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v1
.
put
(
0
,
0
,
1.0
,
3.0
,
2.0
);
v2
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v2
.
put
(
0
,
0
,
2.0
,
1.0
,
3.0
);
}
public
static
void
assertMatEqual
(
Mat
m1
,
Mat
m2
)
{
...
...
@@ -119,29 +125,25 @@ public class OpenCVTestCase extends TestCase {
}
static
private
void
compareMats
(
Mat
m1
,
Mat
m2
,
boolean
isEqualityMeasured
)
{
//
OpenCVTestRunner.Log(m1.toString());
//
OpenCVTestRunner.Log(m2.toString());
//
OpenCVTestRunner.Log(m1.toString());
//
OpenCVTestRunner.Log(m2.toString());
if
(
m1
.
type
()
!=
m2
.
type
()
||
m1
.
cols
()
!=
m2
.
cols
()
||
m1
.
rows
()
!=
m2
.
rows
())
{
if
(
m1
.
type
()
!=
m2
.
type
()
||
m1
.
cols
()
!=
m2
.
cols
()
||
m1
.
rows
()
!=
m2
.
rows
())
{
throw
new
UnsupportedOperationException
();
}
else
if
(
m1
.
channels
()
==
1
)
{
}
else
if
(
m1
.
channels
()
==
1
)
{
if
(
isEqualityMeasured
)
{
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
==
0.0
);
}
else
{
}
else
{
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
!=
0.0
);
}
}
else
{
}
else
{
for
(
int
coi
=
0
;
coi
<
m1
.
channels
();
coi
++)
{
Mat
m1c
=
getCOI
(
m1
,
coi
);
Mat
m2c
=
getCOI
(
m2
,
coi
);
if
(
isEqualityMeasured
)
{
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
==
0.0
);
}
else
{
}
else
{
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
!=
0.0
);
}
}
...
...
@@ -152,8 +154,7 @@ public class OpenCVTestCase extends TestCase {
Mat
ch
=
new
Mat
(
m
.
rows
(),
m
.
cols
(),
m
.
depth
());
for
(
int
i
=
0
;
i
<
m
.
rows
();
i
++)
for
(
int
j
=
0
;
j
<
m
.
cols
();
j
++)
{
for
(
int
j
=
0
;
j
<
m
.
cols
();
j
++)
{
double
pixel
[]
=
m
.
get
(
i
,
j
);
ch
.
put
(
i
,
j
,
pixel
[
coi
]);
}
...
...
@@ -164,14 +165,15 @@ public class OpenCVTestCase extends TestCase {
static
private
double
CalcPercentageOfDifference
(
Mat
m1
,
Mat
m2
)
{
Mat
cmp
=
new
Mat
(
0
,
0
,
CvType
.
CV_8U
);
Core
.
compare
(
m1
,
m2
,
cmp
,
Core
.
CMP_EQ
);
double
difference
=
100.0
*
(
1.0
-
Double
.
valueOf
(
Core
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
double
difference
=
100.0
*
(
1.0
-
Double
.
valueOf
(
Core
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
return
difference
;
}
public
void
test_1
(
String
label
)
{
OpenCVTestRunner
.
Log
(
"================================================"
);
OpenCVTestRunner
.
Log
(
"================================================"
);
OpenCVTestRunner
.
Log
(
"=============== "
+
label
);
}
}
modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java
View file @
039fd554
...
...
@@ -28,16 +28,22 @@ public class calib3dTest extends OpenCVTestCase {
}
public
void
testComposeRTMatMatMatMatMatMat
()
{
Mat
rvec1
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
rvec1
.
put
(
0
,
0
,
0.5302828
,
0.19925919
,
0.40105945
);
Mat
tvec1
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
tvec1
.
put
(
0
,
0
,
0.81438506
,
0.43713298
,
0.2487897
);
Mat
rvec2
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
rvec2
.
put
(
0
,
0
,
0.77310503
,
0.76209372
,
0.30779448
);
Mat
tvec2
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
tvec2
.
put
(
0
,
0
,
0.70243168
,
0.4784472
,
0.79219002
);
Mat
rvec1
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
rvec1
.
put
(
0
,
0
,
0.5302828
,
0.19925919
,
0.40105945
);
Mat
tvec1
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
tvec1
.
put
(
0
,
0
,
0.81438506
,
0.43713298
,
0.2487897
);
Mat
rvec2
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
rvec2
.
put
(
0
,
0
,
0.77310503
,
0.76209372
,
0.30779448
);
Mat
tvec2
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
tvec2
.
put
(
0
,
0
,
0.70243168
,
0.4784472
,
0.79219002
);
Mat
rvec3
=
new
Mat
();
Mat
tvec3
=
new
Mat
();
Mat
outRvec
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
outRvec
.
put
(
0
,
0
,
1.418641
,
0.88665926
,
0.56020796
);
Mat
outTvec
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
outTvec
.
put
(
0
,
0
,
1.4560841
,
1.0680628
,
0.81598103
);
Mat
outRvec
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
outRvec
.
put
(
0
,
0
,
1.418641
,
0.88665926
,
0.56020796
);
Mat
outTvec
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
outTvec
.
put
(
0
,
0
,
1.4560841
,
1.0680628
,
0.81598103
);
Calib3d
.
composeRT
(
rvec1
,
tvec1
,
rvec2
,
tvec2
,
rvec3
,
tvec3
);
...
...
@@ -75,39 +81,39 @@ public class calib3dTest extends OpenCVTestCase {
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
//
Mat dr3dr1;
//
Mat dr3dt1;
//
Mat dr3dr2;
//
Mat dr3dt2;
//
Mat dt3dr1;
//
Mat dt3dt1;
//
Mat dt3dr2;
//
Mat dt3dt2;
//
, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2);
//
[0.97031879, -0.091774099, 0.38594806;
//
0.15181915, 0.98091727, -0.44186208;
//
-0.39509675, 0.43839464, 0.93872648]
//
[0, 0, 0;
//
0, 0, 0;
//
0, 0, 0]
//
[1.0117353, 0.16348237, -0.083180845;
//
-0.1980398, 1.006078, 0.30299222;
//
0.075766489, -0.32784501, 1.0163091]
//
[0, 0, 0;
//
0, 0, 0;
//
0, 0, 0]
//
[0, 0, 0;
//
0, 0, 0;
//
0, 0, 0]
//
[0.69658804, 0.018115902, 0.7172426;
//
0.51114357, 0.68899536, -0.51382649;
//
-0.50348526, 0.72453934, 0.47068608]
//
[0.18536358, -0.20515044, -0.48834875;
//
-0.25120571, 0.29043972, 0.60573936;
//
0.35370794, -0.69923931, 0.45781645]
//
[1, 0, 0;
//
0, 1, 0;
//
0, 0, 1]
//
Mat dr3dr1;
//
Mat dr3dt1;
//
Mat dr3dr2;
//
Mat dr3dt2;
//
Mat dt3dr1;
//
Mat dt3dt1;
//
Mat dt3dr2;
//
Mat dt3dt2;
//
, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2);
//
[0.97031879, -0.091774099, 0.38594806;
//
0.15181915, 0.98091727, -0.44186208;
//
-0.39509675, 0.43839464, 0.93872648]
//
[0, 0, 0;
//
0, 0, 0;
//
0, 0, 0]
//
[1.0117353, 0.16348237, -0.083180845;
//
-0.1980398, 1.006078, 0.30299222;
//
0.075766489, -0.32784501, 1.0163091]
//
[0, 0, 0;
//
0, 0, 0;
//
0, 0, 0]
//
[0, 0, 0;
//
0, 0, 0;
//
0, 0, 0]
//
[0.69658804, 0.018115902, 0.7172426;
//
0.51114357, 0.68899536, -0.51382649;
//
-0.50348526, 0.72453934, 0.47068608]
//
[0.18536358, -0.20515044, -0.48834875;
//
-0.25120571, 0.29043972, 0.60573936;
//
0.35370794, -0.69923931, 0.45781645]
//
[1, 0, 0;
//
0, 1, 0;
//
0, 0, 1]
}
public
void
testConvertPointsFromHomogeneous
()
{
...
...
@@ -156,7 +162,8 @@ public class calib3dTest extends OpenCVTestCase {
public
void
testFilterSpecklesMatDoubleIntDouble
()
{
gray_16s_1024
.
copyTo
(
dst
);
Point
center
=
new
Point
(
gray_16s_1024
.
rows
()/
2
.,
gray_16s_1024
.
cols
()/
2
.);
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
);
...
...
@@ -177,16 +184,64 @@ public class calib3dTest extends OpenCVTestCase {
public
void
testFindChessboardCornersMatSizeMatInt
()
{
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
);
Calib3d
.
CALIB_CB_ADAPTIVE_THRESH
+
Calib3d
.
CALIB_CB_NORMALIZE_IMAGE
+
Calib3d
.
CALIB_CB_FAST_CHECK
);
assertTrue
(!
dst
.
empty
());
}
public
void
testFindCirclesGridDefaultMatSizeMat
()
{
fail
(
"Not yet implemented"
);
int
size
=
300
;
Mat
img
=
new
Mat
(
size
,
size
,
CvType
.
CV_8U
);
img
.
setTo
(
new
Scalar
(
255
));
Mat
centers
=
new
Mat
();
assertFalse
(
Calib3d
.
findCirclesGridDefault
(
img
,
new
Size
(
5
,
5
),
centers
));
for
(
int
i
=
0
;
i
<
5
;
i
++)
for
(
int
j
=
0
;
j
<
5
;
j
++)
{
Point
pt
=
new
Point
(
size
*
(
2
*
i
+
1
)
/
10
,
size
*
(
2
*
j
+
1
)
/
10
);
Core
.
circle
(
img
,
pt
,
10
,
new
Scalar
(
0
),
-
1
);
}
org
.
opencv
.
highgui
.
Highgui
.
imwrite
(
"/mnt/sdcard/test3.png"
,
img
);
assertTrue
(
Calib3d
.
findCirclesGridDefault
(
img
,
new
Size
(
5
,
5
),
centers
));
assertEquals
(
25
,
centers
.
rows
());
assertEquals
(
1
,
centers
.
cols
());
assertEquals
(
CvType
.
CV_32FC2
,
centers
.
type
());
}
public
void
testFindCirclesGridDefaultMatSizeMatInt
()
{
fail
(
"Not yet implemented"
);
int
size
=
300
;
Mat
img
=
new
Mat
(
size
,
size
,
CvType
.
CV_8U
);
img
.
setTo
(
new
Scalar
(
255
));
Mat
centers
=
new
Mat
();
assertFalse
(
Calib3d
.
findCirclesGridDefault
(
img
,
new
Size
(
3
,
5
),
centers
,
Calib3d
.
CALIB_CB_CLUSTERING
|
Calib3d
.
CALIB_CB_ASYMMETRIC_GRID
));
int
step
=
size
*
2
/
15
;
int
offsetx
=
size
/
6
;
int
offsety
=
(
size
-
4
*
step
)
/
2
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
for
(
int
j
=
0
;
j
<
5
;
j
++)
{
Point
pt
=
new
Point
(
offsetx
+
(
2
*
i
+
j
%
2
)
*
step
,
offsety
+
step
*
j
);
Core
.
circle
(
img
,
pt
,
10
,
new
Scalar
(
0
),
-
1
);
}
assertTrue
(
Calib3d
.
findCirclesGridDefault
(
img
,
new
Size
(
3
,
5
),
centers
,
Calib3d
.
CALIB_CB_CLUSTERING
|
Calib3d
.
CALIB_CB_ASYMMETRIC_GRID
));
assertEquals
(
15
,
centers
.
rows
());
assertEquals
(
1
,
centers
.
cols
());
assertEquals
(
CvType
.
CV_32FC2
,
centers
.
type
());
}
public
void
testFindFundamentalMatMatMat
()
{
...
...
modules/java/android_test/src/org/opencv/test/core/RectTest.java
View file @
039fd554
package
org
.
opencv
.
test
.
core
;
import
org.opencv.core.Point
;
import
org.opencv.core.Rect
;
import
org.opencv.test.OpenCVTestCase
;
public
class
RectTest
extends
OpenCVTestCase
{
...
...
@@ -21,7 +23,21 @@ public class RectTest extends OpenCVTestCase {
}
public
void
testContains
()
{
fail
(
"Not yet implemented"
);
Rect
r
=
new
Rect
(
0
,
0
,
10
,
10
);
Point
p_inner
=
new
Point
(
5
,
5
);
Point
p_outer
=
new
Point
(
5
,
55
);
Point
p_bl
=
new
Point
(
0
,
0
);
Point
p_br
=
new
Point
(
10
,
0
);
Point
p_tl
=
new
Point
(
0
,
10
);
Point
p_tr
=
new
Point
(
10
,
10
);
assertTrue
(
r
.
contains
(
p_inner
));
assertTrue
(
r
.
contains
(
p_bl
));
assertFalse
(
r
.
contains
(
p_outer
));
assertFalse
(
r
.
contains
(
p_br
));
assertFalse
(
r
.
contains
(
p_tl
));
assertFalse
(
r
.
contains
(
p_tr
));
}
public
void
testEqualsObject
()
{
...
...
modules/java/android_test/src/org/opencv/test/core/coreTest.java
View file @
039fd554
...
...
@@ -2,6 +2,9 @@ package org.opencv.test.core;
import
java.util.ArrayList
;
import
org.hamcrest.core.IsInstanceOf
;
import
org.junit.internal.runners.statements.ExpectException
;
import
org.opencv.core.CvException
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
...
...
@@ -96,7 +99,10 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_64FC1
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
* CV_COVAR_NORMAL
*/
);
assertMatEqual
(
gray0_64f
,
covar
);
assertMatEqual
(
gray0_64f_1d
,
mean
);
}
...
...
@@ -105,7 +111,10 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
* CV_COVAR_NORMAL
*/
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0_32f
,
covar
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
}
...
...
@@ -113,7 +122,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testCartToPolarMatMatMatMat
()
{
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
...
...
@@ -130,27 +139,45 @@ public class coreTest extends OpenCVTestCase {
public
void
testCartToPolarMatMatMatMatBoolean
()
{
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
Mat
dst_angle
=
new
Mat
();
Core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
Core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
assertMatEqual
(
magnitude
,
dst
);
assertMatEqual
(
angle
,
dst_angle
);
}
public
void
testCheckRangeMat
()
{
fail
(
"Not yet implemented"
);
Mat
outOfRange
=
new
Mat
(
2
,
2
,
CvType
.
CV_64F
);
outOfRange
.
put
(
0
,
0
,
Double
.
NaN
,
Double
.
NEGATIVE_INFINITY
,
Double
.
POSITIVE_INFINITY
,
0
);
assertTrue
(
Core
.
checkRange
(
grayRnd_32f
));
assertTrue
(
Core
.
checkRange
(
new
Mat
()));
assertFalse
(
Core
.
checkRange
(
outOfRange
));
}
public
void
testCheckRangeMatBoolean
()
{
fail
(
"Not yet implemented"
);
Mat
outOfRange
=
new
Mat
(
2
,
2
,
CvType
.
CV_64F
);
outOfRange
.
put
(
0
,
0
,
Double
.
NaN
,
Double
.
NEGATIVE_INFINITY
,
Double
.
POSITIVE_INFINITY
,
0
);
assertFalse
(
Core
.
checkRange
(
outOfRange
,
true
));
try
{
Core
.
checkRange
(
outOfRange
,
false
);
fail
(
"Core.checkRange should throw the CvException"
);
}
catch
(
Exception
e
)
{
if
(!(
e
instanceof
CvException
))
fail
(
"Core.checkRange should throw the CvException"
);
}
}
public
void
testCheckRangeMatBooleanPoint
()
{
...
...
@@ -166,8 +193,8 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testCircleMatPointIntScalar
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
...
...
@@ -176,34 +203,38 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testCircleMatPointIntScalarInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
-
1
/*filled circle
*/
);
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
-
1
/* filled circle
*/
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
public
void
testCircleMatPointIntScalarIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
2
,
4
/*4-connected line
*/
);
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
2
,
4
/* 4-connected line
*/
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
public
void
testCircleMatPointIntScalarIntIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
center2
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
Scalar
color128
=
new
Scalar
(
128
);
Scalar
color0
=
new
Scalar
(
0
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
circle
(
gray0
,
center2
,
radius
*
2
,
color128
,
2
,
4
,
1
/*Number of fractional bits*/
);
Core
.
circle
(
gray0
,
center2
,
radius
*
2
,
color128
,
2
,
4
,
1
/*
* Number of
* fractional
* bits
*/
);
Core
.
circle
(
gray0
,
center
,
radius
,
color0
,
2
,
4
,
0
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
}
...
...
@@ -233,7 +264,6 @@ public class coreTest extends OpenCVTestCase {
assertEquals
(
pt2Clipped
,
pt2
);
}
public
void
testCompare
()
{
Core
.
compare
(
gray0
,
gray0
,
dst
,
Core
.
CMP_EQ
);
assertMatEqual
(
dst
,
gray255
);
...
...
@@ -289,7 +319,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testCubeRoot
()
{
float
res
=
Core
.
cubeRoot
(
27.0f
);
assertEquals
(
3.0f
,
res
);
assertEquals
(
3.0f
,
res
);
}
public
void
testDctMatMat
()
{
...
...
@@ -311,10 +341,12 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual
(
gray0_32f_1d
,
dst
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
in
.
put
(
0
,
0
,
0.203056
,
0.980407
,
0.35312
,
-
0.106651
,
0.0399382
,
0.871475
,
-
0.648355
,
0.501067
);
in
.
put
(
0
,
0
,
0.203056
,
0.980407
,
0.35312
,
-
0.106651
,
0.0399382
,
0.871475
,
-
0.648355
,
0.501067
);
truth
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
0.77571625
,
0.37270021
,
0.18529896
,
0.012146413
,
-
0.32499927
,
-
0.99302113
,
0.55979407
,
-
0.6251272
);
truth
.
put
(
0
,
0
,
0.77571625
,
0.37270021
,
0.18529896
,
0.012146413
,
-
0.32499927
,
-
0.99302113
,
0.55979407
,
-
0.6251272
);
Core
.
dct
(
in
,
dst
);
assertMatEqual
(
truth
,
dst
);
...
...
@@ -427,7 +459,8 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testExp
()
{
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
destination
.
setTo
(
new
Scalar
(
0.0
));
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
destination
.
setTo
(
new
Scalar
(
0.0
));
Core
.
exp
(
gray0_32f
,
destination
);
assertMatEqual
(
gray1_32f
,
destination
);
}
...
...
@@ -440,7 +473,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testFastAtan2
()
{
double
delta
=
0.01
;
float
res
=
Core
.
fastAtan2
(
50
,
50
);
assertEquals
(
45
,
res
,
delta
);
assertEquals
(
45
,
res
,
delta
);
float
res2
=
Core
.
fastAtan2
(
80
,
20
);
assertEquals
(
75.96
,
res2
,
delta
);
...
...
@@ -584,7 +617,8 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
truth
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
truth
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
Core
.
idct
(
in
,
dst
);
assertMatEqual
(
truth
,
dst
);
...
...
@@ -595,7 +629,8 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
truth
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
truth
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
Core
.
idct
(
in
,
dst
,
Core
.
DCT_ROWS
);
assertMatEqual
(
truth
,
dst
);
...
...
@@ -661,11 +696,11 @@ public class coreTest extends OpenCVTestCase {
Core
.
invert
(
src
,
dst
);
assertMatEqual
(
truth
,
dst
);
//
TODO: needs epsilon comparison
//
Mat m = grayRnd_32f.clone();
//
Mat inv = m.inv();
//
Core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
//
assertMatEqual(grayE_32f, dst);
//
TODO: needs epsilon comparison
//
Mat m = grayRnd_32f.clone();
//
Mat inv = m.inv();
//
Core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
//
assertMatEqual(grayE_32f, dst);
}
public
void
testInvertMatMatInt
()
{
...
...
@@ -760,7 +795,7 @@ public class coreTest extends OpenCVTestCase {
out
.
put
(
0
,
0
,
5.0
,
13.0
,
41.0
,
10.0
);
Core
.
magnitude
(
x
,
y
,
dst
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
Core
.
magnitude
(
gray0_32f
,
gray255_32f
,
dst
);
assertMatEqual
(
gray255_32f
,
dst
);
...
...
@@ -769,7 +804,10 @@ public class coreTest extends OpenCVTestCase {
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
* CV_COVAR_NORMAL
*/
,
CvType
.
CV_32F
);
covar
.
inv
();
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
...
...
@@ -825,11 +863,12 @@ public class coreTest extends OpenCVTestCase {
assertEquals
(
0
,
Core
.
countNonZero
(
mean
));
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
Mat
submat
=
grayRnd
.
submat
(
0
,
grayRnd
.
rows
()/
2
,
0
,
grayRnd
.
cols
()/
2
);
Mat
submat
=
grayRnd
.
submat
(
0
,
grayRnd
.
rows
()
/
2
,
0
,
grayRnd
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
33
));
Mat
mask
=
gray0
.
clone
();
submat
=
mask
.
submat
(
0
,
mask
.
rows
()/
2
,
0
,
mask
.
cols
()/
2
);
submat
=
mask
.
submat
(
0
,
mask
.
rows
()
/
2
,
0
,
mask
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1
));
Core
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
mask
);
...
...
@@ -854,10 +893,10 @@ public class coreTest extends OpenCVTestCase {
public
void
testMinMaxLoc
()
{
double
minVal
=
1
;
double
maxVal
=
10
;
Point
minLoc
=
new
Point
(
gray3
.
cols
()/
4
,
gray3
.
rows
()/
2
);
Point
maxLoc
=
new
Point
(
gray3
.
cols
()/
2
,
gray3
.
rows
()/
4
);
gray3
.
put
((
int
)
minLoc
.
y
,
(
int
)
minLoc
.
x
,
minVal
);
gray3
.
put
((
int
)
maxLoc
.
y
,
(
int
)
maxLoc
.
x
,
maxVal
);
Point
minLoc
=
new
Point
(
gray3
.
cols
()
/
4
,
gray3
.
rows
()
/
2
);
Point
maxLoc
=
new
Point
(
gray3
.
cols
()
/
2
,
gray3
.
rows
()
/
4
);
gray3
.
put
((
int
)
minLoc
.
y
,
(
int
)
minLoc
.
x
,
minVal
);
gray3
.
put
((
int
)
maxLoc
.
y
,
(
int
)
maxLoc
.
x
,
maxVal
);
Core
.
MinMaxLocResult
mmres
=
Core
.
minMaxLoc
(
gray3
);
...
...
@@ -867,7 +906,6 @@ public class coreTest extends OpenCVTestCase {
assertTrue
(
mmres
.
maxLoc
.
equals
(
maxLoc
));
}
public
void
testMinMaxLocMat
()
{
fail
(
"Not yet implemented"
);
}
...
...
@@ -1050,7 +1088,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testPerspectiveTransform
()
{
//
nice example
//
nice example
fail
(
"Not yet implemented"
);
}
...
...
@@ -1087,18 +1125,18 @@ public class coreTest extends OpenCVTestCase {
Mat
xCoordinate
=
new
Mat
();
Mat
yCoordinate
=
new
Mat
();
//
x.put(0, 0, 3.0, 6.0, 5,0);
//
y.put(0, 0, 4.0, 8.0, 12.0);
// magnitude.put(0, 0, 5.0, 10.0, 13.0);
//
angle.put(0, 0, 0.92729962, 0.92729962, 1.1759995);
//
x.put(0, 0, 3.0, 6.0, 5,0);
//
y.put(0, 0, 4.0, 8.0, 12.0);
// magnitude.put(0, 0, 5.0, 10.0, 13.0);
//
angle.put(0, 0, 0.92729962, 0.92729962, 1.1759995);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
//
TODO: needs epsilon comparison
//
TODO: needs epsilon comparison
Core
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
assertMatEqual
(
x
,
xCoordinate
);
}
...
...
@@ -1171,8 +1209,8 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testRectangleMatPointPointScalar
()
{
Point
center
=
new
Point
(
gray0
.
cols
()/
2
,
gray0
.
rows
()/
2
);
Point
origin
=
new
Point
(
0
,
0
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
...
...
@@ -1182,7 +1220,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testRectangleMatPointPointScalarInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
Point
origin
=
new
Point
(
0
,
0
);
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
...
...
@@ -1191,8 +1229,8 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testRectangleMatPointPointScalarIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
()/
2
,
gray0
.
rows
()/
2
);
Point
origin
=
new
Point
(
0
,
0
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
...
...
@@ -1202,7 +1240,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testRectangleMatPointPointScalarIntIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
Point
origin
=
new
Point
(
0
,
0
);
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
...
...
@@ -1213,10 +1251,10 @@ public class coreTest extends OpenCVTestCase {
public
void
testReduceMatMatIntInt
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
2
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
1
,
0
,
1
,
0
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
1
,
0
,
1
,
0
);
out
.
put
(
0
,
0
,
1
,
0
);
out
.
put
(
0
,
0
,
1
,
0
);
Core
.
reduce
(
src
,
dst
,
0
,
2
);
assertMatEqual
(
out
,
dst
);
...
...
@@ -1225,10 +1263,10 @@ public class coreTest extends OpenCVTestCase {
public
void
testReduceMatMatIntIntInt
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
2
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
1
,
0
,
1
,
0
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
1
,
0
,
1
,
0
);
out
.
put
(
0
,
0
,
1
,
0
);
out
.
put
(
0
,
0
,
1
,
0
);
Core
.
reduce
(
src
,
dst
,
0
,
2
,
-
1
);
assertMatEqual
(
out
,
dst
);
...
...
@@ -1335,11 +1373,11 @@ public class coreTest extends OpenCVTestCase {
Mat
submat
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1.0
));
Core
.
sort
(
gray0
,
dst
,
0
/*TODO: CV_SORT_EVERY_ROW*/
);
Core
.
sort
(
gray0
,
dst
,
0
/* TODO: CV_SORT_EVERY_ROW */
);
submat
=
dst
.
submat
(
0
,
dst
.
rows
()
/
2
,
dst
.
cols
()
/
2
,
dst
.
cols
());
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
Core
.
sort
(
gray0
,
dst
,
1
/*TODO: CV_SORT_EVERY_COLUMN*/
);
Core
.
sort
(
gray0
,
dst
,
1
/* TODO: CV_SORT_EVERY_COLUMN */
);
submat
=
dst
.
submat
(
dst
.
rows
()
/
2
,
dst
.
rows
(),
0
,
dst
.
cols
()
/
2
);
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
}
...
...
@@ -1353,14 +1391,14 @@ public class coreTest extends OpenCVTestCase {
truth
.
put
(
1
,
0
,
0
,
2
,
1
);
truth
.
put
(
2
,
0
,
0
,
1
,
2
);
Core
.
sortIdx
(
a
,
b
,
0
+
0
/*TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING
*/
);
Core
.
sortIdx
(
a
,
b
,
0
+
0
/* TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING
*/
);
assertMatEqual
(
truth
,
b
);
}
public
void
testSplit
()
{
ArrayList
<
Mat
>
cois
=
new
ArrayList
<
Mat
>();
Core
.
split
(
rgba0
,
cois
);
for
(
Mat
coi
:
cois
)
{
for
(
Mat
coi
:
cois
)
{
assertMatEqual
(
gray0
,
coi
);
}
}
...
...
@@ -1430,8 +1468,10 @@ public class coreTest extends OpenCVTestCase {
public
void
testTranspose
()
{
Mat
subgray0
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
());
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
destination
.
setTo
(
new
Scalar
(
0
));
Mat
subdst
=
destination
.
submat
(
0
,
destination
.
rows
(),
0
,
destination
.
cols
()
/
2
);
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
destination
.
setTo
(
new
Scalar
(
0
));
Mat
subdst
=
destination
.
submat
(
0
,
destination
.
rows
(),
0
,
destination
.
cols
()
/
2
);
subgray0
.
setTo
(
new
Scalar
(
1
));
Core
.
transpose
(
gray0
,
destination
);
assertTrue
(
subdst
.
total
()
==
Core
.
countNonZero
(
subdst
));
...
...
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