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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1966 additions
and
1853 deletions
+1966
-1853
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+116
-114
calib3dTest.java
...android_test/src/org/opencv/test/calib3d/calib3dTest.java
+392
-337
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
+1441
-1401
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
039fd554
...
@@ -8,64 +8,63 @@ import org.opencv.core.Scalar;
...
@@ -8,64 +8,63 @@ import org.opencv.core.Scalar;
import
org.opencv.core.Core
;
import
org.opencv.core.Core
;
import
org.opencv.highgui.Highgui
;
import
org.opencv.highgui.Highgui
;
public
class
OpenCVTestCase
extends
TestCase
{
public
class
OpenCVTestCase
extends
TestCase
{
protected
static
int
matSize
=
10
;
protected
static
int
matSize
=
10
;
protected
static
double
EPS
=
0.001
;
protected
static
double
EPS
=
0.001
;
protected
static
Mat
dst
;
protected
static
Mat
dst
;
protected
static
Mat
truth
;
protected
static
Mat
truth
;
//Naming notation: <channels info>_[depth]_[dimensions]_value
//
Naming notation: <channels info>_[depth]_[dimensions]_value
//
examples: gray0
- single channel 8U 2d Mat filled with 0
//
examples: gray0
- single channel 8U 2d Mat filled with 0
//
grayRnd - single channel 8U 2d Mat filled with random numbers
// grayRnd - single channel 8U 2d Mat filled with random numbers
//
gray0_32f_1d
// gray0_32f_1d
//
TODO: OpenCVTestCase refactorings
//
TODO: OpenCVTestCase refactorings
// - rename matrices
// - rename matrices
// - create some masks
// - create some masks
// - use truth member everywhere
// - use truth member everywhere
protected
static
Mat
gray0
;
protected
static
Mat
gray0
;
protected
static
Mat
gray1
;
protected
static
Mat
gray1
;
protected
static
Mat
gray2
;
protected
static
Mat
gray2
;
protected
static
Mat
gray3
;
protected
static
Mat
gray3
;
protected
static
Mat
gray9
;
protected
static
Mat
gray9
;
protected
static
Mat
gray127
;
protected
static
Mat
gray127
;
protected
static
Mat
gray128
;
protected
static
Mat
gray128
;
protected
static
Mat
gray255
;
protected
static
Mat
gray255
;
protected
static
Mat
grayRnd
;
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
gray_16s_1024
;
protected
static
Mat
gray0_32f
;
protected
static
Mat
gray0_32f
;
protected
static
Mat
gray1_32f
;
protected
static
Mat
gray1_32f
;
protected
static
Mat
gray3_32f
;
protected
static
Mat
gray3_32f
;
protected
static
Mat
gray9_32f
;
protected
static
Mat
gray9_32f
;
protected
static
Mat
gray255_32f
;
protected
static
Mat
gray255_32f
;
protected
static
Mat
grayE_32f
;
protected
static
Mat
grayE_32f
;
protected
static
Mat
grayRnd_32f
;
protected
static
Mat
grayRnd_32f
;
protected
static
Mat
gray0_32f_1d
;
protected
static
Mat
gray0_32f_1d
;
protected
static
Mat
gray0_64f
;
protected
static
Mat
gray0_64f
;
protected
static
Mat
gray0_64f_1d
;
protected
static
Mat
gray0_64f_1d
;
protected
static
Mat
rgba0
;
protected
static
Mat
rgba0
;
protected
static
Mat
rgba128
;
protected
static
Mat
rgba128
;
protected
static
Mat
rgbLena
;
protected
static
Mat
rgbLena
;
protected
static
Mat
grayChess
;
protected
static
Mat
grayChess
;
protected
static
Mat
v1
;
protected
static
Mat
v1
;
protected
static
Mat
v2
;
protected
static
Mat
v2
;
@Override
@Override
protected
void
setUp
()
throws
Exception
{
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
super
.
setUp
();
dst
=
new
Mat
();
dst
=
new
Mat
();
assertTrue
(
dst
.
empty
());
assertTrue
(
dst
.
empty
());
truth
=
new
Mat
();
truth
=
new
Mat
();
...
@@ -79,99 +78,102 @@ public class OpenCVTestCase extends TestCase {
...
@@ -79,99 +78,102 @@ public class OpenCVTestCase extends TestCase {
gray127
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
127
));
gray127
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
127
));
gray128
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
128
));
gray128
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
128
));
gray255
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
255
));
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_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
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
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
));
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
));
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
));
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
));
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
));
gray255_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
grayE_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayE_32f
=
Mat
.
eye
(
matSize
,
matSize
,
CvType
.
CV_32FC1
);
new
Scalar
(
255.0
));
grayRnd_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Core
.
randu
(
grayRnd_32f
,
low
,
high
);
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
));
gray0_32f_1d
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
0.0
));
gray0_64f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64F
,
new
Scalar
(
0.0
));
gray0_64f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64F
,
new
Scalar
(
0.0
));
gray0_64f_1d
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_64F
,
new
Scalar
(
0.0
));
gray0_64f_1d
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_64F
,
new
Scalar
(
0.0
));
rgba0
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC4
,
Scalar
.
all
(
0
));
rgba0
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC4
,
Scalar
.
all
(
0
));
rgba128
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC4
,
Scalar
.
all
(
128
));
rgba128
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC4
,
Scalar
.
all
(
128
));
rgbLena
=
Highgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
rgbLena
=
Highgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
grayChess
=
Highgui
.
imread
(
OpenCVTestRunner
.
CHESS_PATH
,
0
);
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
);
v1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v2
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v2
.
put
(
0
,
0
,
2.0
,
1.0
,
3.0
);
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
)
{
public
static
void
assertMatEqual
(
Mat
m1
,
Mat
m2
)
{
compareMats
(
m1
,
m2
,
true
);
compareMats
(
m1
,
m2
,
true
);
}
}
public
static
void
assertMatNotEqual
(
Mat
m1
,
Mat
m2
)
{
public
static
void
assertMatNotEqual
(
Mat
m1
,
Mat
m2
)
{
compareMats
(
m1
,
m2
,
false
);
compareMats
(
m1
,
m2
,
false
);
}
}
static
private
void
compareMats
(
Mat
m1
,
Mat
m2
,
boolean
isEqualityMeasured
)
{
static
private
void
compareMats
(
Mat
m1
,
Mat
m2
,
boolean
isEqualityMeasured
)
{
//OpenCVTestRunner.Log(m1.toString());
// OpenCVTestRunner.Log(m1.toString());
//OpenCVTestRunner.Log(m2.toString());
// OpenCVTestRunner.Log(m2.toString());
if
(
m1
.
type
()
!=
m2
.
type
()
||
if
(
m1
.
type
()
!=
m2
.
type
()
||
m1
.
cols
()
!=
m2
.
cols
()
m1
.
cols
()
!=
m2
.
cols
()
||
m1
.
rows
()
!=
m2
.
rows
())
{
||
m1
.
rows
()
!=
m2
.
rows
())
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
else
if
(
m1
.
channels
()
==
1
)
{
else
if
(
m1
.
channels
()
==
1
)
{
if
(
isEqualityMeasured
)
{
if
(
isEqualityMeasured
)
{
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
==
0.0
);
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
==
0.0
);
}
else
{
}
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
!=
0.0
);
else
{
}
assertTrue
(
CalcPercentageOfDifference
(
m1
,
m2
)
!=
0.0
);
}
else
{
}
for
(
int
coi
=
0
;
coi
<
m1
.
channels
();
coi
++)
{
}
Mat
m1c
=
getCOI
(
m1
,
coi
);
else
{
Mat
m2c
=
getCOI
(
m2
,
coi
);
for
(
int
coi
=
0
;
coi
<
m1
.
channels
();
coi
++)
{
if
(
isEqualityMeasured
)
{
Mat
m1c
=
getCOI
(
m1
,
coi
);
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
==
0.0
);
Mat
m2c
=
getCOI
(
m2
,
coi
);
}
else
{
if
(
isEqualityMeasured
)
{
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
!=
0.0
);
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
==
0.0
);
}
}
}
else
{
}
assertTrue
(
CalcPercentageOfDifference
(
m1c
,
m2c
)
!=
0.0
);
}
}
}
}
}
static
private
Mat
getCOI
(
Mat
m
,
int
coi
)
{
static
private
Mat
getCOI
(
Mat
m
,
int
coi
)
{
Mat
ch
=
new
Mat
(
m
.
rows
(),
m
.
cols
(),
m
.
depth
());
Mat
ch
=
new
Mat
(
m
.
rows
(),
m
.
cols
(),
m
.
depth
());
for
(
int
i
=
0
;
i
<
m
.
rows
();
i
++)
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
);
double
pixel
[]
=
m
.
get
(
i
,
j
);
ch
.
put
(
i
,
j
,
pixel
[
coi
]);
ch
.
put
(
i
,
j
,
pixel
[
coi
]);
}
}
return
ch
;
return
ch
;
}
}
static
private
double
CalcPercentageOfDifference
(
Mat
m1
,
Mat
m2
)
{
static
private
double
CalcPercentageOfDifference
(
Mat
m1
,
Mat
m2
)
{
Mat
cmp
=
new
Mat
(
0
,
0
,
CvType
.
CV_8U
);
Mat
cmp
=
new
Mat
(
0
,
0
,
CvType
.
CV_8U
);
Core
.
compare
(
m1
,
m2
,
cmp
,
Core
.
CMP_EQ
);
Core
.
compare
(
m1
,
m2
,
cmp
,
Core
.
CMP_EQ
);
double
difference
=
100.0
*
double
difference
=
100.0
*
(
1.0
-
Double
.
valueOf
(
Core
(
1.0
-
Double
.
valueOf
(
Core
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
return
difference
;
return
difference
;
}
}
public
void
test_1
(
String
label
)
{
public
void
test_1
(
String
label
)
{
OpenCVTestRunner
.
Log
(
"================================================"
);
OpenCVTestRunner
OpenCVTestRunner
.
Log
(
"=============== "
+
label
);
.
Log
(
"================================================"
);
OpenCVTestRunner
.
Log
(
"=============== "
+
label
);
}
}
}
}
modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java
View file @
039fd554
...
@@ -10,363 +10,418 @@ import org.opencv.core.Core;
...
@@ -10,363 +10,418 @@ import org.opencv.core.Core;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestCase
;
public
class
calib3dTest
extends
OpenCVTestCase
{
public
class
calib3dTest
extends
OpenCVTestCase
{
public
void
test_1
()
{
super
.
test_1
(
"calib3d"
);
}
public
void
testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalibrationMatrixValues
()
{
fail
(
"Not yet implemented"
);
}
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
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
);
Calib3d
.
composeRT
(
rvec1
,
tvec1
,
rvec2
,
tvec2
,
rvec3
,
tvec3
);
assertMatEqual
(
outRvec
,
rvec3
);
assertMatEqual
(
outTvec
,
tvec3
);
}
public
void
testComposeRTMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
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]
}
public
void
testConvertPointsFromHomogeneous
()
{
fail
(
"Not yet implemented"
);
}
public
void
testConvertPointsToHomogeneous
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDrawChessboardCorners
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateAffine3DMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateAffine3DMatMatMatMatDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateAffine3DMatMatMatMatDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFilterSpecklesMatDoubleIntDouble
()
{
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
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindChessboardCornersMatSizeMat
()
{
Size
patternSize
=
new
Size
(
9
,
6
);
Calib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
);
assertTrue
(!
dst
.
empty
());
}
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
);
assertTrue
(!
dst
.
empty
());
}
public
void
testFindCirclesGridDefaultMatSizeMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindCirclesGridDefaultMatSizeMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatIntDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatIntDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatIntDoubleDoubleMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMatIntDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMatIntDoubleMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDoubleSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRect
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRectBoolean
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetValidDisparityROI
()
{
fail
(
"Not yet implemented"
);
}
public
void
testInitCameraMatrix2DListOfMatListOfMatSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testInitCameraMatrix2DListOfMatListOfMatSizeDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMatMulDeriv
()
{
fail
(
"Not yet implemented"
);
}
public
void
testProjectPointsMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testProjectPointsMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testProjectPointsMatMatMatMatMatMatMatDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testRectify3Collinear
()
{
fail
(
"Not yet implemented"
);
}
public
void
testReprojectImageTo3DMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testReprojectImageTo3DMatMatMatBoolean
()
{
fail
(
"Not yet implemented"
);
}
public
void
testReprojectImageTo3DMatMatMatBooleanInt
()
{
public
void
test_1
()
{
fail
(
"Not yet implemented"
);
super
.
test_1
(
"calib3d"
);
}
}
public
void
testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalibrationMatrixValues
()
{
fail
(
"Not yet implemented"
);
}
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
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
);
Calib3d
.
composeRT
(
rvec1
,
tvec1
,
rvec2
,
tvec2
,
rvec3
,
tvec3
);
assertMatEqual
(
outRvec
,
rvec3
);
assertMatEqual
(
outTvec
,
tvec3
);
}
public
void
testComposeRTMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
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]
}
public
void
testConvertPointsFromHomogeneous
()
{
fail
(
"Not yet implemented"
);
}
public
void
testConvertPointsToHomogeneous
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDecomposeProjectionMatrixMatMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDrawChessboardCorners
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateAffine3DMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateAffine3DMatMatMatMatDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateAffine3DMatMatMatMatDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFilterSpecklesMatDoubleIntDouble
()
{
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
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindChessboardCornersMatSizeMat
()
{
Size
patternSize
=
new
Size
(
9
,
6
);
Calib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
);
assertTrue
(!
dst
.
empty
());
}
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
);
assertTrue
(!
dst
.
empty
());
}
public
void
testFindCirclesGridDefaultMatSizeMat
()
{
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
()
{
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
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatIntDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatIntDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindFundamentalMatMatMatIntDoubleDoubleMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMatInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMatIntDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testFindHomographyMatMatIntDoubleMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDoubleSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRect
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRectBoolean
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetValidDisparityROI
()
{
fail
(
"Not yet implemented"
);
}
public
void
testInitCameraMatrix2DListOfMatListOfMatSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testInitCameraMatrix2DListOfMatListOfMatSizeDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMatMulDeriv
()
{
fail
(
"Not yet implemented"
);
}
public
void
testProjectPointsMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testProjectPointsMatMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testProjectPointsMatMatMatMatMatMatMatDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testRectify3Collinear
()
{
fail
(
"Not yet implemented"
);
}
public
void
testReprojectImageTo3DMatMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testReprojectImageTo3DMatMatMatBoolean
()
{
fail
(
"Not yet implemented"
);
}
public
void
testReprojectImageTo3DMatMatMatBooleanInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testRodriguesMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testRodrigues
MatMat
()
{
public
void
testRodriguesMat
MatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRodrigues
MatMatMat
()
{
public
void
testRQDecomp3x3
MatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRQDecomp3x3
MatMatMat
()
{
public
void
testRQDecomp3x3Mat
MatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRQDecomp3x3
MatMatMatMat
()
{
public
void
testRQDecomp3x3Mat
MatMatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRQDecomp3x3
MatMatMatMatMat
()
{
public
void
testRQDecomp3x3Mat
MatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRQDecomp3x3
MatMatMatMatMatMat
()
{
public
void
testSolvePnP
MatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPMatMatMatMatMatMat
()
{
public
void
testSolvePnPMatMatMatMatMatMatBoolean
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPMatMatMatMatMatMatBoolean
()
{
public
void
testSolvePnPRansacMatMatMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPRansacMatMatMatMatMatMat
()
{
public
void
testSolvePnPRansacMatMatMatMatMatMatBoolean
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPRansacMatMatMatMatMatMatBoolean
()
{
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIn
t
()
{
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloa
t
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloa
t
()
{
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIn
t
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIn
t
()
{
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIntMa
t
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIn
tMat
()
{
public
void
testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMa
tMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMat
()
{
public
void
testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteria
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteria
()
{
public
void
testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteriaInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteriaIn
t
()
{
public
void
testStereoRectifyUncalibratedMatMatMatSizeMatMa
t
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testStereoRectifyUncalibratedMatMatMatSizeMatMat
()
{
public
void
testStereoRectifyUncalibratedMatMatMatSizeMatMatDouble
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testStereoRectifyUncalibratedMatMatMatSizeMatMatDouble
()
{
public
void
testValidateDisparityMatMatIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testValidateDisparityMatMatIntInt
()
{
public
void
testValidateDisparityMatMatIntIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testValidateDisparityMatMatIntIntInt
()
{
fail
(
"Not yet implemented"
);
}
}
}
modules/java/android_test/src/org/opencv/test/core/RectTest.java
View file @
039fd554
package
org
.
opencv
.
test
.
core
;
package
org
.
opencv
.
test
.
core
;
import
org.opencv.core.Point
;
import
org.opencv.core.Rect
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestCase
;
public
class
RectTest
extends
OpenCVTestCase
{
public
class
RectTest
extends
OpenCVTestCase
{
...
@@ -21,7 +23,21 @@ public class RectTest extends OpenCVTestCase {
...
@@ -21,7 +23,21 @@ public class RectTest extends OpenCVTestCase {
}
}
public
void
testContains
()
{
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
()
{
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;
...
@@ -2,6 +2,9 @@ package org.opencv.test.core;
import
java.util.ArrayList
;
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.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Point
;
...
@@ -11,1430 +14,1467 @@ import org.opencv.core.Core;
...
@@ -11,1430 +14,1467 @@ import org.opencv.core.Core;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestCase
;
public
class
coreTest
extends
OpenCVTestCase
{
public
class
coreTest
extends
OpenCVTestCase
{
public
void
test_1
()
{
public
void
test_1
()
{
super
.
test_1
(
"CORE"
);
super
.
test_1
(
"CORE"
);
}
}
public
void
testAbsdiff
()
{
public
void
testAbsdiff
()
{
Core
.
absdiff
(
gray128
,
gray255
,
dst
);
Core
.
absdiff
(
gray128
,
gray255
,
dst
);
assertMatEqual
(
gray127
,
dst
);
assertMatEqual
(
gray127
,
dst
);
}
}
public
void
testAddMatMatMat
()
{
public
void
testAddMatMatMat
()
{
Core
.
add
(
gray128
,
gray128
,
dst
);
Core
.
add
(
gray128
,
gray128
,
dst
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testAddMatMatMatMat
()
{
public
void
testAddMatMatMatMat
()
{
Core
.
add
(
gray0
,
gray1
,
dst
,
gray1
);
Core
.
add
(
gray0
,
gray1
,
dst
,
gray1
);
assertMatEqual
(
gray1
,
dst
);
assertMatEqual
(
gray1
,
dst
);
dst
.
setTo
(
new
Scalar
(
127
));
dst
.
setTo
(
new
Scalar
(
127
));
Core
.
add
(
gray0
,
gray1
,
dst
,
gray0
);
Core
.
add
(
gray0
,
gray1
,
dst
,
gray0
);
assertMatEqual
(
gray127
,
dst
);
assertMatEqual
(
gray127
,
dst
);
}
}
public
void
testAddMatMatMatMatInt
()
{
public
void
testAddMatMatMatMatInt
()
{
Core
.
add
(
gray0
,
gray1
,
dst
,
gray1
,
CvType
.
CV_32F
);
Core
.
add
(
gray0
,
gray1
,
dst
,
gray1
,
CvType
.
CV_32F
);
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertMatEqual
(
gray1_32f
,
dst
);
assertMatEqual
(
gray1_32f
,
dst
);
}
}
public
void
testAddWeightedMatDoubleMatDoubleDoubleMat
()
{
public
void
testAddWeightedMatDoubleMatDoubleDoubleMat
()
{
Core
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
);
Core
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testAddWeightedMatDoubleMatDoubleDoubleMatInt
()
{
public
void
testAddWeightedMatDoubleMatDoubleDoubleMatInt
()
{
Core
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
,
CvType
.
CV_32F
);
Core
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
,
CvType
.
CV_32F
);
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertMatEqual
(
gray255_32f
,
dst
);
assertMatEqual
(
gray255_32f
,
dst
);
}
}
public
void
testBitwise_andMatMatMat
()
{
public
void
testBitwise_andMatMatMat
()
{
Core
.
bitwise_and
(
gray3
,
gray2
,
dst
);
Core
.
bitwise_and
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
}
}
public
void
testBitwise_andMatMatMatMat
()
{
public
void
testBitwise_andMatMatMatMat
()
{
Core
.
bitwise_and
(
gray0
,
gray1
,
dst
,
gray255
);
Core
.
bitwise_and
(
gray0
,
gray1
,
dst
,
gray255
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testBitwise_notMatMat
()
{
public
void
testBitwise_notMatMat
()
{
Core
.
bitwise_not
(
gray255
,
dst
);
Core
.
bitwise_not
(
gray255
,
dst
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testBitwise_notMatMatMat
()
{
public
void
testBitwise_notMatMatMat
()
{
Core
.
bitwise_not
(
gray255
,
dst
,
gray255
);
Core
.
bitwise_not
(
gray255
,
dst
,
gray255
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testBitwise_orMatMatMat
()
{
public
void
testBitwise_orMatMatMat
()
{
Core
.
bitwise_or
(
gray3
,
gray2
,
dst
);
Core
.
bitwise_or
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray3
,
dst
);
assertMatEqual
(
gray3
,
dst
);
}
}
public
void
testBitwise_orMatMatMatMat
()
{
public
void
testBitwise_orMatMatMatMat
()
{
Core
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
Core
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testBitwise_xorMatMatMat
()
{
public
void
testBitwise_xorMatMatMat
()
{
Core
.
bitwise_xor
(
gray3
,
gray2
,
dst
);
Core
.
bitwise_xor
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray1
,
dst
);
assertMatEqual
(
gray1
,
dst
);
}
}
public
void
testBitwise_xorMatMatMatMat
()
{
public
void
testBitwise_xorMatMatMatMat
()
{
Core
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
Core
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testCalcCovarMatrixMatMatMatInt
()
{
public
void
testCalcCovarMatrixMatMatMatInt
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64FC1
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
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
/*
assertMatEqual
(
gray0_64f
,
covar
);
* TODO:
assertMatEqual
(
gray0_64f_1d
,
mean
);
* CV_COVAR_NORMAL
}
*/
);
assertMatEqual
(
gray0_64f
,
covar
);
public
void
testCalcCovarMatrixMatMatMatIntInt
()
{
assertMatEqual
(
gray0_64f_1d
,
mean
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
}
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
public
void
testCalcCovarMatrixMatMatMatIntInt
()
{
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0_32f
,
covar
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
}
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
public
void
testCartToPolarMatMatMatMat
()
{
* CV_COVAR_NORMAL
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
*/
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0_32f
,
covar
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
}
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
public
void
testCartToPolarMatMatMatMat
()
{
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
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
);
Mat
dst_angle
=
new
Mat
();
Core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
);
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
assertMatEqual
(
magnitude
,
dst
);
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
assertMatEqual
(
angle
,
dst_angle
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
}
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
public
void
testCartToPolarMatMatMatMatBoolean
()
{
Mat
dst_angle
=
new
Mat
();
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
assertMatEqual
(
magnitude
,
dst
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
assertMatEqual
(
angle
,
dst_angle
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
}
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
public
void
testCartToPolarMatMatMatMatBoolean
()
{
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
Mat
dst_angle
=
new
Mat
();
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
assertMatEqual
(
magnitude
,
dst
);
assertMatEqual
(
angle
,
dst_angle
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
}
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
public
void
testCheckRangeMat
()
{
Mat
dst_angle
=
new
Mat
();
fail
(
"Not yet implemented"
);
Core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
}
assertMatEqual
(
magnitude
,
dst
);
assertMatEqual
(
angle
,
dst_angle
);
public
void
testCheckRangeMatBoolean
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testCheckRangeMat
()
{
Mat
outOfRange
=
new
Mat
(
2
,
2
,
CvType
.
CV_64F
);
public
void
testCheckRangeMatBooleanPoint
()
{
outOfRange
.
put
(
0
,
0
,
Double
.
NaN
,
Double
.
NEGATIVE_INFINITY
,
fail
(
"Not yet implemented"
);
Double
.
POSITIVE_INFINITY
,
0
);
}
assertTrue
(
Core
.
checkRange
(
grayRnd_32f
));
public
void
testCheckRangeMatBooleanPointDouble
()
{
assertTrue
(
Core
.
checkRange
(
new
Mat
()));
fail
(
"Not yet implemented"
);
assertFalse
(
Core
.
checkRange
(
outOfRange
));
}
}
public
void
testCheckRangeMatBooleanPointDoubleDouble
()
{
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
);
public
void
testCircleMatPointIntScalar
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
assertFalse
(
Core
.
checkRange
(
outOfRange
,
true
));
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Scalar
color
=
new
Scalar
(
128
);
try
{
Core
.
checkRange
(
outOfRange
,
false
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
fail
(
"Core.checkRange should throw the CvException"
);
Core
.
circle
(
gray0
,
center
,
radius
,
color
);
}
catch
(
Exception
e
)
{
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
if
(!(
e
instanceof
CvException
))
}
fail
(
"Core.checkRange should throw the CvException"
);
}
public
void
testCircleMatPointIntScalarInt
()
{
}
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
public
void
testCheckRangeMatBooleanPoint
()
{
Scalar
color
=
new
Scalar
(
128
);
fail
(
"Not yet implemented"
);
}
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
-
1
/*filled circle*/
);
public
void
testCheckRangeMatBooleanPointDouble
()
{
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
fail
(
"Not yet implemented"
);
}
}
public
void
testCircleMatPointIntScalarIntInt
()
{
public
void
testCheckRangeMatBooleanPointDoubleDouble
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
fail
(
"Not yet implemented"
);
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
}
Scalar
color
=
new
Scalar
(
128
);
public
void
testCircleMatPointIntScalar
()
{
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
2
,
4
/*4-connected line*/
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
Scalar
color
=
new
Scalar
(
128
);
}
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
public
void
testCircleMatPointIntScalarIntIntInt
()
{
Core
.
circle
(
gray0
,
center
,
radius
,
color
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()/
2
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
Point
center2
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
}
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Scalar
color128
=
new
Scalar
(
128
);
public
void
testCircleMatPointIntScalarInt
()
{
Scalar
color0
=
new
Scalar
(
0
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Scalar
color
=
new
Scalar
(
128
);
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
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
-
1
/* filled circle */
);
}
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
public
void
testClipLine
()
{
Rect
r
=
new
Rect
(
10
,
10
,
10
,
10
);
public
void
testCircleMatPointIntScalarIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
pt1
=
new
Point
(
5.0
,
15.0
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
Point
pt2
=
new
Point
(
25.0
,
15.0
);
Scalar
color
=
new
Scalar
(
128
);
Point
pt1Clipped
=
new
Point
(
10.0
,
15.0
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Point
pt2Clipped
=
new
Point
(
19.0
,
15.0
);
Core
.
circle
(
gray0
,
center
,
radius
,
color
,
2
,
4
/* 4-connected line */
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
boolean
res
=
Core
.
clipLine
(
r
,
pt1
,
pt2
);
}
assertEquals
(
true
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
public
void
testCircleMatPointIntScalarIntIntInt
()
{
assertEquals
(
pt2Clipped
,
pt2
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
center2
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
pt1
=
new
Point
(
5.0
,
5.0
);
int
radius
=
Math
.
min
(
gray0
.
cols
()
/
4
,
gray0
.
rows
()
/
4
);
pt2
=
new
Point
(
25.0
,
5.0
);
Scalar
color128
=
new
Scalar
(
128
);
pt1Clipped
=
new
Point
(
5.0
,
5.0
);
Scalar
color0
=
new
Scalar
(
0
);
pt2Clipped
=
new
Point
(
25.0
,
5.0
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
res
=
Core
.
clipLine
(
r
,
pt1
,
pt2
);
Core
.
circle
(
gray0
,
center2
,
radius
*
2
,
color128
,
2
,
4
,
1
/*
assertEquals
(
false
,
res
);
* Number of
assertEquals
(
pt1Clipped
,
pt1
);
* fractional
assertEquals
(
pt2Clipped
,
pt2
);
* bits
}
*/
);
Core
.
circle
(
gray0
,
center
,
radius
,
color0
,
2
,
4
,
0
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
public
void
testCompare
()
{
}
public
void
testClipLine
()
{
Rect
r
=
new
Rect
(
10
,
10
,
10
,
10
);
Point
pt1
=
new
Point
(
5.0
,
15.0
);
Point
pt2
=
new
Point
(
25.0
,
15.0
);
Point
pt1Clipped
=
new
Point
(
10.0
,
15.0
);
Point
pt2Clipped
=
new
Point
(
19.0
,
15.0
);
boolean
res
=
Core
.
clipLine
(
r
,
pt1
,
pt2
);
assertEquals
(
true
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
assertEquals
(
pt2Clipped
,
pt2
);
pt1
=
new
Point
(
5.0
,
5.0
);
pt2
=
new
Point
(
25.0
,
5.0
);
pt1Clipped
=
new
Point
(
5.0
,
5.0
);
pt2Clipped
=
new
Point
(
25.0
,
5.0
);
res
=
Core
.
clipLine
(
r
,
pt1
,
pt2
);
assertEquals
(
false
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
assertEquals
(
pt2Clipped
,
pt2
);
}
public
void
testCompare
()
{
Core
.
compare
(
gray0
,
gray0
,
dst
,
Core
.
CMP_EQ
);
Core
.
compare
(
gray0
,
gray0
,
dst
,
Core
.
CMP_EQ
);
assertMatEqual
(
dst
,
gray255
);
assertMatEqual
(
dst
,
gray255
);
Core
.
compare
(
gray0
,
gray1
,
dst
,
Core
.
CMP_EQ
);
Core
.
compare
(
gray0
,
gray1
,
dst
,
Core
.
CMP_EQ
);
assertMatEqual
(
dst
,
gray0
);
assertMatEqual
(
dst
,
gray0
);
Core
.
compare
(
gray0
,
grayRnd
,
dst
,
Core
.
CMP_EQ
);
Core
.
compare
(
gray0
,
grayRnd
,
dst
,
Core
.
CMP_EQ
);
double
nBlackPixels
=
Core
.
countNonZero
(
dst
);
double
nBlackPixels
=
Core
.
countNonZero
(
dst
);
double
nNonBlackpixels
=
Core
.
countNonZero
(
grayRnd
);
double
nNonBlackpixels
=
Core
.
countNonZero
(
grayRnd
);
assertTrue
((
nBlackPixels
+
nNonBlackpixels
)
==
grayRnd
.
total
());
assertTrue
((
nBlackPixels
+
nNonBlackpixels
)
==
grayRnd
.
total
());
}
}
public
void
testCompleteSymmMat
()
{
public
void
testCompleteSymmMat
()
{
Core
.
completeSymm
(
grayRnd_32f
);
Core
.
completeSymm
(
grayRnd_32f
);
Core
.
transpose
(
grayRnd_32f
,
dst
);
Core
.
transpose
(
grayRnd_32f
,
dst
);
assertMatEqual
(
grayRnd_32f
,
dst
);
assertMatEqual
(
grayRnd_32f
,
dst
);
}
}
public
void
testCompleteSymmMatBoolean
()
{
public
void
testCompleteSymmMatBoolean
()
{
Core
.
completeSymm
(
grayRnd_32f
,
true
);
Core
.
completeSymm
(
grayRnd_32f
,
true
);
Core
.
transpose
(
grayRnd_32f
,
dst
);
Core
.
transpose
(
grayRnd_32f
,
dst
);
assertMatEqual
(
grayRnd_32f
,
dst
);
assertMatEqual
(
grayRnd_32f
,
dst
);
}
}
public
void
testConvertScaleAbsMatMat
()
{
public
void
testConvertScaleAbsMatMat
()
{
Core
.
convertScaleAbs
(
gray0
,
dst
);
Core
.
convertScaleAbs
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
Core
.
convertScaleAbs
(
gray_16u_256
,
dst
);
Core
.
convertScaleAbs
(
gray_16u_256
,
dst
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testConvertScaleAbsMatMatDouble
()
{
public
void
testConvertScaleAbsMatMatDouble
()
{
Core
.
convertScaleAbs
(
gray0
,
dst
,
2
);
Core
.
convertScaleAbs
(
gray0
,
dst
,
2
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
Core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
1
);
Core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
1
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testConvertScaleAbsMatMatDoubleDouble
()
{
public
void
testConvertScaleAbsMatMatDoubleDouble
()
{
Core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
2
,
2
);
Core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
2
,
2
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testCountNonZero
()
{
public
void
testCountNonZero
()
{
assertEquals
(
0
,
Core
.
countNonZero
(
gray0
));
assertEquals
(
0
,
Core
.
countNonZero
(
gray0
));
gray0
.
put
(
0
,
0
,
255
);
gray0
.
put
(
0
,
0
,
255
);
gray0
.
put
(
gray0
.
rows
()
-
1
,
gray0
.
cols
()
-
1
,
255
);
gray0
.
put
(
gray0
.
rows
()
-
1
,
gray0
.
cols
()
-
1
,
255
);
assertEquals
(
2
,
Core
.
countNonZero
(
gray0
));
assertEquals
(
2
,
Core
.
countNonZero
(
gray0
));
}
}
public
void
testCubeRoot
()
{
public
void
testCubeRoot
()
{
float
res
=
Core
.
cubeRoot
(
27.0f
);
float
res
=
Core
.
cubeRoot
(
27.0f
);
assertEquals
(
3.0f
,
res
);
assertEquals
(
3.0f
,
res
);
}
}
public
void
testDctMatMat
()
{
public
void
testDctMatMat
()
{
Core
.
dct
(
gray0_32f_1d
,
dst
);
Core
.
dct
(
gray0_32f_1d
,
dst
);
assertMatEqual
(
gray0_32f_1d
,
dst
);
assertMatEqual
(
gray0_32f_1d
,
dst
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
in
.
put
(
0
,
0
,
135.22211
,
50.811096
,
102.27016
,
207.6682
);
in
.
put
(
0
,
0
,
135.22211
,
50.811096
,
102.27016
,
207.6682
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
247.98576
,
-
61.252407
,
94.904533
,
14.013477
);
truth
.
put
(
0
,
0
,
247.98576
,
-
61.252407
,
94.904533
,
14.013477
);
Core
.
dct
(
in
,
dst
);
Core
.
dct
(
in
,
dst
);
assertMatEqual
(
truth
,
dst
);
assertMatEqual
(
truth
,
dst
);
}
}
public
void
testDctMatMatInt
()
{
public
void
testDctMatMatInt
()
{
Core
.
dct
(
gray0_32f_1d
,
dst
);
Core
.
dct
(
gray0_32f_1d
,
dst
);
assertMatEqual
(
gray0_32f_1d
,
dst
);
assertMatEqual
(
gray0_32f_1d
,
dst
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
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
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
0.77571625
,
0.37270021
,
0.18529896
,
0.012146413
,
Core
.
dct
(
in
,
dst
);
-
0.32499927
,
-
0.99302113
,
0.55979407
,
-
0.6251272
);
assertMatEqual
(
truth
,
dst
);
}
Core
.
dct
(
in
,
dst
);
assertMatEqual
(
truth
,
dst
);
public
void
testDeterminant
()
{
}
Mat
mat
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
mat
.
put
(
0
,
0
,
4.0
);
public
void
testDeterminant
()
{
mat
.
put
(
0
,
1
,
2.0
);
Mat
mat
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
mat
.
put
(
1
,
0
,
4.0
);
mat
.
put
(
0
,
0
,
4.0
);
mat
.
put
(
1
,
1
,
4.0
);
mat
.
put
(
0
,
1
,
2.0
);
mat
.
put
(
1
,
0
,
4.0
);
double
det
=
Core
.
determinant
(
mat
);
mat
.
put
(
1
,
1
,
4.0
);
assertEquals
(
8.0
,
det
);
}
double
det
=
Core
.
determinant
(
mat
);
assertEquals
(
8.0
,
det
);
public
void
testDftMatMat
()
{
}
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
0
,
0
,
0
,
0
);
public
void
testDftMatMat
()
{
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
0
,
0
,
0
,
0
);
truth
.
put
(
0
,
0
,
0
,
0
,
0
,
0
);
Core
.
dft
(
src
,
dst
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
assertMatEqual
(
truth
,
dst
);
truth
.
put
(
0
,
0
,
0
,
0
,
0
,
0
);
}
Core
.
dft
(
src
,
dst
);
assertMatEqual
(
truth
,
dst
);
public
void
testDftMatMatInt
()
{
}
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
public
void
testDftMatMatInt
()
{
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
2
,
3
,
4
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
10
,
-
2
,
2
,
-
2
);
Core
.
dft
(
src
,
dst
,
Core
.
DFT_REAL_OUTPUT
);
src
.
put
(
0
,
0
,
1
,
2
,
3
,
4
);
assertMatEqual
(
truth
,
dst
);
truth
.
put
(
0
,
0
,
10
,
-
2
,
2
,
-
2
);
Core
.
dft
(
src
,
dst
,
Core
.
DFT_REAL_OUTPUT
);
Core
.
dft
(
src
,
dst
,
Core
.
DFT_INVERSE
);
assertMatEqual
(
truth
,
dst
);
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
assertMatEqual
(
truth
,
dst
);
Core
.
dft
(
src
,
dst
,
Core
.
DFT_INVERSE
);
}
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
assertMatEqual
(
truth
,
dst
);
public
void
testDftMatMatIntInt
()
{
}
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
2
,
3
,
4
);
public
void
testDftMatMatIntInt
()
{
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
2
,
3
,
4
);
truth
.
put
(
0
,
0
,
10
,
-
2
,
2
,
-
2
);
Core
.
dft
(
src
,
dst
,
Core
.
DFT_REAL_OUTPUT
,
1
);
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
assertMatEqual
(
truth
,
dst
);
truth
.
put
(
0
,
0
,
10
,
-
2
,
2
,
-
2
);
}
Core
.
dft
(
src
,
dst
,
Core
.
DFT_REAL_OUTPUT
,
1
);
assertMatEqual
(
truth
,
dst
);
public
void
testDivideDoubleMatMat
()
{
}
Core
.
divide
(
4.0
,
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
public
void
testDivideDoubleMatMat
()
{
}
Core
.
divide
(
4.0
,
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
public
void
testDivideDoubleMatMatInt
()
{
}
Core
.
divide
(
9.0
,
gray3
,
dst
,
-
1
);
assertMatEqual
(
gray3
,
dst
);
public
void
testDivideDoubleMatMatInt
()
{
}
Core
.
divide
(
9.0
,
gray3
,
dst
,
-
1
);
assertMatEqual
(
gray3
,
dst
);
public
void
testDivideMatMatMat
()
{
}
Core
.
divide
(
gray2
,
gray1
,
dst
);
assertMatEqual
(
gray2
,
dst
);
public
void
testDivideMatMatMat
()
{
}
Core
.
divide
(
gray2
,
gray1
,
dst
);
assertMatEqual
(
gray2
,
dst
);
public
void
testDivideMatMatMatDouble
()
{
}
Core
.
divide
(
gray2
,
gray2
,
dst
,
2.0
);
assertMatEqual
(
gray2
,
dst
);
public
void
testDivideMatMatMatDouble
()
{
}
Core
.
divide
(
gray2
,
gray2
,
dst
,
2.0
);
assertMatEqual
(
gray2
,
dst
);
public
void
testDivideMatMatMatDoubleInt
()
{
}
Core
.
divide
(
gray3
,
gray2
,
dst
,
2.0
,
gray3
.
depth
());
assertMatEqual
(
gray3
,
dst
);
public
void
testDivideMatMatMatDoubleInt
()
{
}
Core
.
divide
(
gray3
,
gray2
,
dst
,
2.0
,
gray3
.
depth
());
assertMatEqual
(
gray3
,
dst
);
public
void
testEigen
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEigen
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipse2Poly
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipse2Poly
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalar
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalar
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarInt
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatRotatedRectScalar
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatRotatedRectScalar
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatRotatedRectScalarInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatRotatedRectScalarInt
()
{
fail
(
"Not yet implemented"
);
public
void
testEllipseMatRotatedRectScalarIntInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatRotatedRectScalarIntInt
()
{
fail
(
"Not yet implemented"
);
public
void
testExp
()
{
}
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
destination
.
setTo
(
new
Scalar
(
0.0
));
Core
.
exp
(
gray0_32f
,
destination
);
public
void
testExp
()
{
assertMatEqual
(
gray1_32f
,
destination
);
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
}
destination
.
setTo
(
new
Scalar
(
0.0
));
Core
.
exp
(
gray0_32f
,
destination
);
public
void
testExtractChannel
()
{
assertMatEqual
(
gray1_32f
,
destination
);
Core
.
extractChannel
(
rgba128
,
dst
,
0
);
}
assertMatEqual
(
gray128
,
dst
);
}
public
void
testExtractChannel
()
{
Core
.
extractChannel
(
rgba128
,
dst
,
0
);
public
void
testFastAtan2
()
{
assertMatEqual
(
gray128
,
dst
);
double
delta
=
0.01
;
}
float
res
=
Core
.
fastAtan2
(
50
,
50
);
assertEquals
(
45
,
res
,
delta
);
public
void
testFastAtan2
()
{
double
delta
=
0.01
;
float
res2
=
Core
.
fastAtan2
(
80
,
20
);
float
res
=
Core
.
fastAtan2
(
50
,
50
);
assertEquals
(
75.96
,
res2
,
delta
);
assertEquals
(
45
,
res
,
delta
);
}
float
res2
=
Core
.
fastAtan2
(
80
,
20
);
public
void
testFillConvexPolyMatMatScalar
()
{
assertEquals
(
75.96
,
res2
,
delta
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillConvexPolyMatMatScalar
()
{
public
void
testFillConvexPolyMatMatScalarInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillConvexPolyMatMatScalarInt
()
{
public
void
testFillConvexPolyMatMatScalarIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillConvexPolyMatMatScalarIntInt
()
{
public
void
testFillPolyMatListOfMatScalar
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillPolyMatListOfMatScalar
()
{
public
void
testFillPolyMatListOfMatScalarInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillPolyMatListOfMatScalarInt
()
{
public
void
testFillPolyMatListOfMatScalarIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillPolyMatListOfMatScalarIntInt
()
{
public
void
testFillPolyMatListOfMatScalarIntIntPoint
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testFillPolyMatListOfMatScalarIntIntPoint
()
{
public
void
testFlip
()
{
fail
(
"Not yet implemented"
);
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
}
Mat
des_f0
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1.0
);
public
void
testFlip
()
{
src
.
put
(
0
,
1
,
2.0
);
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
src
.
put
(
1
,
0
,
3.0
);
Mat
des_f0
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
src
.
put
(
1
,
1
,
4.0
);
src
.
put
(
0
,
0
,
1.0
);
src
.
put
(
0
,
1
,
2.0
);
des_f0
.
put
(
0
,
0
,
3.0
);
src
.
put
(
1
,
0
,
3.0
);
des_f0
.
put
(
0
,
1
,
4.0
);
src
.
put
(
1
,
1
,
4.0
);
des_f0
.
put
(
1
,
0
,
1.0
);
des_f0
.
put
(
1
,
1
,
2.0
);
des_f0
.
put
(
0
,
0
,
3.0
);
Core
.
flip
(
src
,
dst
,
0
);
des_f0
.
put
(
0
,
1
,
4.0
);
assertMatEqual
(
des_f0
,
dst
);
des_f0
.
put
(
1
,
0
,
1.0
);
des_f0
.
put
(
1
,
1
,
2.0
);
Mat
des_f1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Core
.
flip
(
src
,
dst
,
0
);
des_f1
.
put
(
0
,
0
,
2.0
);
assertMatEqual
(
des_f0
,
dst
);
des_f1
.
put
(
0
,
1
,
1.0
);
des_f1
.
put
(
1
,
0
,
4.0
);
Mat
des_f1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
des_f1
.
put
(
1
,
1
,
3.0
);
des_f1
.
put
(
0
,
0
,
2.0
);
Core
.
flip
(
src
,
dst
,
1
);
des_f1
.
put
(
0
,
1
,
1.0
);
assertMatEqual
(
des_f1
,
dst
);
des_f1
.
put
(
1
,
0
,
4.0
);
}
des_f1
.
put
(
1
,
1
,
3.0
);
Core
.
flip
(
src
,
dst
,
1
);
public
void
testGemmMatMatDoubleMatDoubleMat
()
{
assertMatEqual
(
des_f1
,
dst
);
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
}
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
desired
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
public
void
testGemmMatMatDoubleMatDoubleMat
()
{
Mat
dmatrix
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
m1
.
put
(
0
,
0
,
1.0
,
0.0
);
Mat
desired
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
m1
.
put
(
1
,
0
,
1.0
,
0.0
);
Mat
dmatrix
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
m2
.
put
(
0
,
0
,
1.0
,
0.0
);
m1
.
put
(
0
,
0
,
1.0
,
0.0
);
m2
.
put
(
1
,
0
,
1.0
,
0.0
);
m1
.
put
(
1
,
0
,
1.0
,
0.0
);
dmatrix
.
put
(
0
,
0
,
0.001
,
0.001
);
m2
.
put
(
0
,
0
,
1.0
,
0.0
);
dmatrix
.
put
(
1
,
0
,
0.001
,
0.001
);
m2
.
put
(
1
,
0
,
1.0
,
0.0
);
desired
.
put
(
0
,
0
,
1.001
,
0.001
);
dmatrix
.
put
(
0
,
0
,
0.001
,
0.001
);
desired
.
put
(
1
,
0
,
1.001
,
0.001
);
dmatrix
.
put
(
1
,
0
,
0.001
,
0.001
);
Core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
);
desired
.
put
(
0
,
0
,
1.001
,
0.001
);
assertMatEqual
(
desired
,
dst
);
desired
.
put
(
1
,
0
,
1.001
,
0.001
);
}
Core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
);
public
void
testGemmMatMatDoubleMatDoubleMatInt
()
{
assertMatEqual
(
desired
,
dst
);
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
}
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
desired
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
public
void
testGemmMatMatDoubleMatDoubleMatInt
()
{
Mat
dmatrix
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
m1
.
put
(
0
,
0
,
1.0
,
0.0
);
Mat
desired
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
m1
.
put
(
1
,
0
,
1.0
,
0.0
);
Mat
dmatrix
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
m2
.
put
(
0
,
0
,
1.0
,
0.0
);
m1
.
put
(
0
,
0
,
1.0
,
0.0
);
m2
.
put
(
1
,
0
,
1.0
,
0.0
);
m1
.
put
(
1
,
0
,
1.0
,
0.0
);
dmatrix
.
put
(
0
,
0
,
0.001
,
0.001
);
m2
.
put
(
0
,
0
,
1.0
,
0.0
);
dmatrix
.
put
(
1
,
0
,
0.001
,
0.001
);
m2
.
put
(
1
,
0
,
1.0
,
0.0
);
desired
.
put
(
0
,
0
,
2.001
,
0.001
);
dmatrix
.
put
(
0
,
0
,
0.001
,
0.001
);
desired
.
put
(
1
,
0
,
0.001
,
0.001
);
dmatrix
.
put
(
1
,
0
,
0.001
,
0.001
);
Core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
,
Core
.
GEMM_1_T
);
desired
.
put
(
0
,
0
,
2.001
,
0.001
);
assertMatEqual
(
desired
,
dst
);
desired
.
put
(
1
,
0
,
0.001
,
0.001
);
}
Core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
,
Core
.
GEMM_1_T
);
public
void
testGetCPUTickCount
()
{
assertMatEqual
(
desired
,
dst
);
fail
(
"Not yet implemented"
);
}
}
public
void
testGetCPUTickCount
()
{
public
void
testGetOptimalDFTSize
()
{
fail
(
"Not yet implemented"
);
int
vecsize
=
Core
.
getOptimalDFTSize
(
0
);
}
assertEquals
(
1
,
vecsize
);
public
void
testGetOptimalDFTSize
()
{
int
largeVecSize
=
Core
.
getOptimalDFTSize
(
133
);
int
vecsize
=
Core
.
getOptimalDFTSize
(
0
);
assertEquals
(
135
,
largeVecSize
);
assertEquals
(
1
,
vecsize
);
largeVecSize
=
Core
.
getOptimalDFTSize
(
13
);
assertEquals
(
15
,
largeVecSize
);
int
largeVecSize
=
Core
.
getOptimalDFTSize
(
133
);
}
assertEquals
(
135
,
largeVecSize
);
largeVecSize
=
Core
.
getOptimalDFTSize
(
13
);
public
void
testGetTextSize
()
{
assertEquals
(
15
,
largeVecSize
);
fail
(
"Not yet implemented"
);
}
}
public
void
testGetTextSize
()
{
public
void
testGetTickCount
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testGetTickCount
()
{
public
void
testGetTickFrequency
()
{
fail
(
"Not yet implemented"
);
double
freq
=
0.0
;
}
freq
=
Core
.
getTickFrequency
();
assertTrue
(
0.0
!=
freq
);
public
void
testGetTickFrequency
()
{
}
double
freq
=
0.0
;
freq
=
Core
.
getTickFrequency
();
public
void
testHconcat
()
{
assertTrue
(
0.0
!=
freq
);
Mat
e
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_8UC1
);
}
Mat
eConcat
=
new
Mat
(
1
,
9
,
CvType
.
CV_8UC1
);
eConcat
.
put
(
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
);
public
void
testHconcat
()
{
Mat
e
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_8UC1
);
Core
.
hconcat
(
e
,
dst
);
Mat
eConcat
=
new
Mat
(
1
,
9
,
CvType
.
CV_8UC1
);
assertMatEqual
(
eConcat
,
dst
);
eConcat
.
put
(
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
);
}
Core
.
hconcat
(
e
,
dst
);
public
void
testIdctMatMat
()
{
assertMatEqual
(
eConcat
,
dst
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
}
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
public
void
testIdctMatMat
()
{
truth
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
Mat
in
=
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
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
Core
.
idct
(
in
,
dst
);
truth
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
assertMatEqual
(
truth
,
dst
);
truth
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
}
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
public
void
testIdctMatMatInt
()
{
Core
.
idct
(
in
,
dst
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
assertMatEqual
(
truth
,
dst
);
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
);
public
void
testIdctMatMatInt
()
{
truth
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
Core
.
idct
(
in
,
dst
,
Core
.
DCT_ROWS
);
assertMatEqual
(
truth
,
dst
);
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
);
public
void
testIdftMatMat
()
{
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
idct
(
in
,
dst
,
Core
.
DCT_ROWS
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
assertMatEqual
(
truth
,
dst
);
}
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
public
void
testIdftMatMat
()
{
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
idft
(
in
,
dst
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
assertMatEqual
(
truth
,
dst
);
}
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
public
void
testIdftMatMatInt
()
{
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
idft
(
in
,
dst
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
assertMatEqual
(
truth
,
dst
);
}
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
public
void
testIdftMatMatInt
()
{
Core
.
idft
(
in
,
dst
,
Core
.
DFT_REAL_OUTPUT
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
assertMatEqual
(
truth
,
dst
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
}
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
public
void
testIdftMatMatIntInt
()
{
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
idft
(
in
,
dst
,
Core
.
DFT_REAL_OUTPUT
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
assertMatEqual
(
truth
,
dst
);
}
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
public
void
testIdftMatMatIntInt
()
{
Core
.
idft
(
in
,
dst
,
Core
.
DFT_REAL_OUTPUT
,
1
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
assertMatEqual
(
truth
,
dst
);
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
}
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
public
void
testInRange
()
{
truth
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
Core
.
inRange
(
gray0
,
gray0
,
gray1
,
dst
);
Core
.
idft
(
in
,
dst
,
Core
.
DFT_REAL_OUTPUT
,
1
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
truth
,
dst
);
}
}
public
void
testInsertChannel
()
{
public
void
testInRange
()
{
Core
.
insertChannel
(
gray0
,
rgba128
,
0
);
Core
.
inRange
(
gray0
,
gray0
,
gray1
,
dst
);
Core
.
insertChannel
(
gray0
,
rgba128
,
1
);
assertMatEqual
(
gray255
,
dst
);
Core
.
insertChannel
(
gray0
,
rgba128
,
2
);
}
Core
.
insertChannel
(
gray0
,
rgba128
,
3
);
assertMatEqual
(
rgba0
,
rgba128
);
public
void
testInsertChannel
()
{
}
Core
.
insertChannel
(
gray0
,
rgba128
,
0
);
Core
.
insertChannel
(
gray0
,
rgba128
,
1
);
public
void
testInvertMatMat
()
{
Core
.
insertChannel
(
gray0
,
rgba128
,
2
);
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Core
.
insertChannel
(
gray0
,
rgba128
,
3
);
src
.
put
(
0
,
0
,
1.0
);
assertMatEqual
(
rgba0
,
rgba128
);
src
.
put
(
0
,
1
,
2.0
);
}
src
.
put
(
1
,
0
,
1.5
);
src
.
put
(
1
,
1
,
4.0
);
public
void
testInvertMatMat
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
truth
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1.0
);
truth
.
put
(
0
,
0
,
4.0
);
src
.
put
(
0
,
1
,
2.0
);
truth
.
put
(
0
,
1
,
-
2.0
);
src
.
put
(
1
,
0
,
1.5
);
truth
.
put
(
1
,
0
,
-
1.5
);
src
.
put
(
1
,
1
,
4.0
);
truth
.
put
(
1
,
1
,
1.0
);
truth
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Core
.
invert
(
src
,
dst
);
truth
.
put
(
0
,
0
,
4.0
);
assertMatEqual
(
truth
,
dst
);
truth
.
put
(
0
,
1
,
-
2.0
);
truth
.
put
(
1
,
0
,
-
1.5
);
//TODO: needs epsilon comparison
truth
.
put
(
1
,
1
,
1.0
);
// Mat m = grayRnd_32f.clone();
// Mat inv = m.inv();
Core
.
invert
(
src
,
dst
);
// Core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
assertMatEqual
(
truth
,
dst
);
// assertMatEqual(grayE_32f, dst);
}
// TODO: needs epsilon comparison
// Mat m = grayRnd_32f.clone();
public
void
testInvertMatMatInt
()
{
// Mat inv = m.inv();
Mat
src
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_32FC1
);
// Core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
// assertMatEqual(grayE_32f, dst);
truth
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_32FC1
);
}
Core
.
invert
(
src
,
dst
,
Core
.
DECOMP_CHOLESKY
);
public
void
testInvertMatMatInt
()
{
assertMatEqual
(
truth
,
dst
);
Mat
src
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_32FC1
);
Core
.
invert
(
src
,
dst
,
Core
.
DECOMP_LU
);
truth
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_32FC1
);
double
det
=
Core
.
determinant
(
src
);
assertTrue
(
det
>
0.0
);
Core
.
invert
(
src
,
dst
,
Core
.
DECOMP_CHOLESKY
);
}
assertMatEqual
(
truth
,
dst
);
public
void
testKmeansMatIntMatTermCriteriaIntInt
()
{
Core
.
invert
(
src
,
dst
,
Core
.
DECOMP_LU
);
fail
(
"Not yet implemented"
);
double
det
=
Core
.
determinant
(
src
);
}
assertTrue
(
det
>
0.0
);
}
public
void
testKmeansMatIntMatTermCriteriaIntIntMat
()
{
fail
(
"Not yet implemented"
);
public
void
testKmeansMatIntMatTermCriteriaIntInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testLineMatPointPointScalar
()
{
int
nPoints
=
Math
.
min
(
gray0
.
cols
(),
gray0
.
rows
());
public
void
testKmeansMatIntMatTermCriteriaIntIntMat
()
{
fail
(
"Not yet implemented"
);
Point
point1
=
new
Point
(
0
,
0
);
}
Point
point2
=
new
Point
(
nPoints
,
nPoints
);
Scalar
color
=
new
Scalar
(
255
);
public
void
testLineMatPointPointScalar
()
{
int
nPoints
=
Math
.
min
(
gray0
.
cols
(),
gray0
.
rows
());
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
line
(
gray0
,
point1
,
point2
,
color
);
Point
point1
=
new
Point
(
0
,
0
);
assertTrue
(
nPoints
==
Core
.
countNonZero
(
gray0
));
Point
point2
=
new
Point
(
nPoints
,
nPoints
);
}
Scalar
color
=
new
Scalar
(
255
);
public
void
testLineMatPointPointScalarInt
()
{
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
int
nPoints
=
Math
.
min
(
gray0
.
cols
(),
gray0
.
rows
());
Core
.
line
(
gray0
,
point1
,
point2
,
color
);
assertTrue
(
nPoints
==
Core
.
countNonZero
(
gray0
));
Point
point1
=
new
Point
(
0
,
0
);
}
Point
point2
=
new
Point
(
nPoints
,
nPoints
);
Scalar
color
=
new
Scalar
(
255
);
public
void
testLineMatPointPointScalarInt
()
{
int
nPoints
=
Math
.
min
(
gray0
.
cols
(),
gray0
.
rows
());
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
line
(
gray0
,
point1
,
point2
,
color
,
0
);
Point
point1
=
new
Point
(
0
,
0
);
assertTrue
(
nPoints
==
Core
.
countNonZero
(
gray0
));
Point
point2
=
new
Point
(
nPoints
,
nPoints
);
}
Scalar
color
=
new
Scalar
(
255
);
public
void
testLineMatPointPointScalarIntInt
()
{
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
fail
(
"Not yet implemented"
);
Core
.
line
(
gray0
,
point1
,
point2
,
color
,
0
);
}
assertTrue
(
nPoints
==
Core
.
countNonZero
(
gray0
));
}
public
void
testLineMatPointPointScalarIntIntInt
()
{
fail
(
"Not yet implemented"
);
public
void
testLineMatPointPointScalarIntInt
()
{
}
fail
(
"Not yet implemented"
);
}
public
void
testLog
()
{
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
);
public
void
testLineMatPointPointScalarIntIntInt
()
{
Mat
desired
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
);
fail
(
"Not yet implemented"
);
in
.
put
(
0
,
0
,
1.0
,
10.0
,
100.0
,
1000.0
);
}
desired
.
put
(
0
,
0
,
0
,
2.3025851
,
4.6051702
,
6.9077554
);
public
void
testLog
()
{
Core
.
log
(
in
,
dst
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
);
assertMatEqual
(
desired
,
dst
);
Mat
desired
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
);
}
in
.
put
(
0
,
0
,
1.0
,
10.0
,
100.0
,
1000.0
);
desired
.
put
(
0
,
0
,
0
,
2.3025851
,
4.6051702
,
6.9077554
);
public
void
testLUTMatMatMat
()
{
Mat
lut
=
new
Mat
(
1
,
256
,
CvType
.
CV_8UC1
);
Core
.
log
(
in
,
dst
);
assertMatEqual
(
desired
,
dst
);
lut
.
setTo
(
new
Scalar
(
0
));
}
Core
.
LUT
(
grayRnd
,
lut
,
dst
);
assertMatEqual
(
gray0
,
dst
);
public
void
testLUTMatMatMat
()
{
Mat
lut
=
new
Mat
(
1
,
256
,
CvType
.
CV_8UC1
);
lut
.
setTo
(
new
Scalar
(
255
));
Core
.
LUT
(
grayRnd
,
lut
,
dst
);
lut
.
setTo
(
new
Scalar
(
0
));
assertMatEqual
(
gray255
,
dst
);
Core
.
LUT
(
grayRnd
,
lut
,
dst
);
}
assertMatEqual
(
gray0
,
dst
);
public
void
testLUTMatMatMatInt
()
{
lut
.
setTo
(
new
Scalar
(
255
));
Mat
lut
=
new
Mat
(
1
,
256
,
CvType
.
CV_8UC1
);
Core
.
LUT
(
grayRnd
,
lut
,
dst
);
lut
.
setTo
(
new
Scalar
(
255
));
assertMatEqual
(
gray255
,
dst
);
Core
.
LUT
(
grayRnd
,
lut
,
dst
,
0
);
}
assertMatEqual
(
gray255
,
dst
);
}
public
void
testLUTMatMatMatInt
()
{
Mat
lut
=
new
Mat
(
1
,
256
,
CvType
.
CV_8UC1
);
public
void
testMagnitude
()
{
lut
.
setTo
(
new
Scalar
(
255
));
Mat
x
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
LUT
(
grayRnd
,
lut
,
dst
,
0
);
Mat
y
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
assertMatEqual
(
gray255
,
dst
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
}
x
.
put
(
0
,
0
,
3.0
,
5.0
,
9.0
,
6.0
);
public
void
testMagnitude
()
{
y
.
put
(
0
,
0
,
4.0
,
12.0
,
40.0
,
8.0
);
Mat
x
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
out
.
put
(
0
,
0
,
5.0
,
13.0
,
41.0
,
10.0
);
Mat
y
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
x
.
put
(
0
,
0
,
3.0
,
5.0
,
9.0
,
6.0
);
y
.
put
(
0
,
0
,
4.0
,
12.0
,
40.0
,
8.0
);
out
.
put
(
0
,
0
,
5.0
,
13.0
,
41.0
,
10.0
);
Core
.
magnitude
(
x
,
y
,
dst
);
Core
.
magnitude
(
x
,
y
,
dst
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
Core
.
magnitude
(
gray0_32f
,
gray255_32f
,
dst
);
Core
.
magnitude
(
gray0_32f
,
gray255_32f
,
dst
);
assertMatEqual
(
gray255_32f
,
dst
);
assertMatEqual
(
gray255_32f
,
dst
);
}
}
public
void
testMahalanobis
()
{
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
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
/*
covar
.
inv
();
* TODO:
* CV_COVAR_NORMAL
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
*/
,
CvType
.
CV_32F
);
Mat
line2
=
grayRnd_32f
.
submat
(
1
,
2
,
0
,
grayRnd_32f
.
cols
());
covar
.
inv
();
double
d
=
0.0
;
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
d
=
Core
.
Mahalanobis
(
line1
,
line1
,
covar
);
Mat
line2
=
grayRnd_32f
.
submat
(
1
,
2
,
0
,
grayRnd_32f
.
cols
());
assertEquals
(
0.0
,
d
);
double
d
=
0.0
;
d
=
Core
.
Mahalanobis
(
line1
,
line2
,
covar
);
d
=
Core
.
Mahalanobis
(
line1
,
line1
,
covar
);
assertTrue
(
d
>
0.0
);
assertEquals
(
0.0
,
d
);
}
d
=
Core
.
Mahalanobis
(
line1
,
line2
,
covar
);
public
void
testMax
()
{
assertTrue
(
d
>
0.0
);
Core
.
min
(
gray0
,
gray255
,
dst
);
}
assertMatEqual
(
gray0
,
dst
);
public
void
testMax
()
{
Mat
x
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
Core
.
min
(
gray0
,
gray255
,
dst
);
Mat
y
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0
,
dst
);
Mat
dst
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
x
.
put
(
0
,
0
,
23.0
);
Mat
x
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
y
.
put
(
0
,
0
,
4.0
);
Mat
y
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
dst
.
put
(
0
,
0
,
23.0
);
Mat
dst
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
Core
.
max
(
x
,
y
,
dst
);
x
.
put
(
0
,
0
,
23.0
);
assertMatEqual
(
dst
,
dst
);
y
.
put
(
0
,
0
,
4.0
);
}
dst
.
put
(
0
,
0
,
23.0
);
Core
.
max
(
x
,
y
,
dst
);
public
void
testMeanMat
()
{
assertMatEqual
(
dst
,
dst
);
Scalar
mean
=
null
;
}
mean
=
Core
.
mean
(
gray128
);
public
void
testMeanMat
()
{
assertEquals
(
new
Scalar
(
128
),
mean
);
Scalar
mean
=
null
;
}
mean
=
Core
.
mean
(
gray128
);
public
void
testMeanMatMat
()
{
assertEquals
(
new
Scalar
(
128
),
mean
);
fail
(
"Not yet implemented"
);
}
}
public
void
testMeanMatMat
()
{
public
void
testMeanStdDevMatMatMat
()
{
fail
(
"Not yet implemented"
);
Mat
mean
=
new
Mat
();
}
Mat
stddev
=
new
Mat
();
public
void
testMeanStdDevMatMatMat
()
{
Core
.
meanStdDev
(
rgba0
,
mean
,
stddev
);
Mat
mean
=
new
Mat
();
assertEquals
(
0
,
Core
.
countNonZero
(
mean
));
Mat
stddev
=
new
Mat
();
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
}
Core
.
meanStdDev
(
rgba0
,
mean
,
stddev
);
assertEquals
(
0
,
Core
.
countNonZero
(
mean
));
public
void
testMeanStdDevMatMatMatMat
()
{
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
Mat
mean
=
new
Mat
();
}
Mat
stddev
=
new
Mat
();
public
void
testMeanStdDevMatMatMatMat
()
{
Core
.
meanStdDev
(
rgba0
,
mean
,
stddev
,
gray255
);
Mat
mean
=
new
Mat
();
assertEquals
(
0
,
Core
.
countNonZero
(
mean
));
Mat
stddev
=
new
Mat
();
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
Core
.
meanStdDev
(
rgba0
,
mean
,
stddev
,
gray255
);
Mat
submat
=
grayRnd
.
submat
(
0
,
grayRnd
.
rows
()/
2
,
0
,
grayRnd
.
cols
()/
2
);
assertEquals
(
0
,
Core
.
countNonZero
(
mean
));
submat
.
setTo
(
new
Scalar
(
33
));
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
Mat
mask
=
gray0
.
clone
();
Mat
submat
=
grayRnd
.
submat
(
0
,
grayRnd
.
rows
()
/
2
,
0
,
submat
=
mask
.
submat
(
0
,
mask
.
rows
()/
2
,
0
,
mask
.
cols
()/
2
);
grayRnd
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1
));
submat
.
setTo
(
new
Scalar
(
33
));
Core
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
mask
);
Mat
mask
=
gray0
.
clone
();
Mat
desiredMean
=
new
Mat
(
1
,
1
,
CvType
.
CV_64F
,
new
Scalar
(
33
));
submat
=
mask
.
submat
(
0
,
mask
.
rows
()
/
2
,
0
,
mask
.
cols
()
/
2
);
assertMatEqual
(
desiredMean
,
mean
);
submat
.
setTo
(
new
Scalar
(
1
));
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
Core
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
mask
);
Core
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
gray1
);
Mat
desiredMean
=
new
Mat
(
1
,
1
,
CvType
.
CV_64F
,
new
Scalar
(
33
));
assertTrue
(
0
!=
Core
.
countNonZero
(
mean
));
assertMatEqual
(
desiredMean
,
mean
);
assertTrue
(
0
!=
Core
.
countNonZero
(
stddev
));
assertEquals
(
0
,
Core
.
countNonZero
(
stddev
));
}
Core
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
gray1
);
public
void
testMerge
()
{
assertTrue
(
0
!=
Core
.
countNonZero
(
mean
));
fail
(
"Not yet implemented"
);
assertTrue
(
0
!=
Core
.
countNonZero
(
stddev
));
}
}
public
void
testMin
()
{
public
void
testMerge
()
{
Core
.
min
(
gray0
,
gray255
,
dst
);
fail
(
"Not yet implemented"
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testMin
()
{
public
void
testMinMaxLoc
()
{
Core
.
min
(
gray0
,
gray255
,
dst
);
double
minVal
=
1
;
assertMatEqual
(
gray0
,
dst
);
double
maxVal
=
10
;
}
Point
minLoc
=
new
Point
(
gray3
.
cols
()/
4
,
gray3
.
rows
()/
2
);
Point
maxLoc
=
new
Point
(
gray3
.
cols
()/
2
,
gray3
.
rows
()/
4
);
public
void
testMinMaxLoc
()
{
gray3
.
put
((
int
)
minLoc
.
y
,
(
int
)
minLoc
.
x
,
minVal
);
double
minVal
=
1
;
gray3
.
put
((
int
)
maxLoc
.
y
,
(
int
)
maxLoc
.
x
,
maxVal
);
double
maxVal
=
10
;
Point
minLoc
=
new
Point
(
gray3
.
cols
()
/
4
,
gray3
.
rows
()
/
2
);
Core
.
MinMaxLocResult
mmres
=
Core
.
minMaxLoc
(
gray3
);
Point
maxLoc
=
new
Point
(
gray3
.
cols
()
/
2
,
gray3
.
rows
()
/
4
);
gray3
.
put
((
int
)
minLoc
.
y
,
(
int
)
minLoc
.
x
,
minVal
);
assertTrue
(
mmres
.
minVal
==
minVal
);
gray3
.
put
((
int
)
maxLoc
.
y
,
(
int
)
maxLoc
.
x
,
maxVal
);
assertTrue
(
mmres
.
maxVal
==
maxVal
);
assertTrue
(
mmres
.
minLoc
.
equals
(
minLoc
));
Core
.
MinMaxLocResult
mmres
=
Core
.
minMaxLoc
(
gray3
);
assertTrue
(
mmres
.
maxLoc
.
equals
(
maxLoc
));
}
assertTrue
(
mmres
.
minVal
==
minVal
);
assertTrue
(
mmres
.
maxVal
==
maxVal
);
assertTrue
(
mmres
.
minLoc
.
equals
(
minLoc
));
public
void
testMinMaxLocMat
()
{
assertTrue
(
mmres
.
maxLoc
.
equals
(
maxLoc
));
fail
(
"Not yet implemented"
);
}
}
public
void
testMinMaxLocMat
()
{
public
void
testMinMaxLocMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testMinMaxLocMatMat
()
{
public
void
testMixChannels
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testMixChannels
()
{
public
void
testMulSpectrumsMatMatMatInt
()
{
fail
(
"Not yet implemented"
);
Mat
src1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
}
Mat
src2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
public
void
testMulSpectrumsMatMatMatInt
()
{
src1
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
Mat
src1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src2
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
Mat
src2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
out
.
put
(
0
,
0
,
1
,
-
5
,
12
,
16
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
mulSpectrums
(
src1
,
src2
,
dst
,
Core
.
DFT_ROWS
);
src1
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
assertMatEqual
(
out
,
dst
);
src2
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
}
out
.
put
(
0
,
0
,
1
,
-
5
,
12
,
16
);
Core
.
mulSpectrums
(
src1
,
src2
,
dst
,
Core
.
DFT_ROWS
);
public
void
testMulSpectrumsMatMatMatIntBoolean
()
{
assertMatEqual
(
out
,
dst
);
Mat
src1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
}
Mat
src2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
public
void
testMulSpectrumsMatMatMatIntBoolean
()
{
src1
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
Mat
src1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src2
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
Mat
src2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
out
.
put
(
0
,
0
,
1
,
13
,
0
,
16
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Core
.
mulSpectrums
(
src1
,
src2
,
dst
,
Core
.
DFT_ROWS
,
true
);
src1
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
assertMatEqual
(
out
,
dst
);
src2
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
}
out
.
put
(
0
,
0
,
1
,
13
,
0
,
16
);
Core
.
mulSpectrums
(
src1
,
src2
,
dst
,
Core
.
DFT_ROWS
,
true
);
public
void
testMultiplyMatMatMat
()
{
assertMatEqual
(
out
,
dst
);
Core
.
multiply
(
gray0
,
gray255
,
dst
);
}
assertMatEqual
(
gray0
,
dst
);
}
public
void
testMultiplyMatMatMat
()
{
Core
.
multiply
(
gray0
,
gray255
,
dst
);
public
void
testMultiplyMatMatMatDouble
()
{
assertMatEqual
(
gray0
,
dst
);
Core
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
);
}
assertMatEqual
(
gray0
,
dst
);
public
void
testMultiplyMatMatMatDouble
()
{
}
Core
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
);
assertMatEqual
(
gray0
,
dst
);
public
void
testMultiplyMatMatMatDoubleInt
()
{
Core
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
,
-
1
);
}
assertMatEqual
(
gray0
,
dst
);
}
public
void
testMultiplyMatMatMatDoubleInt
()
{
Core
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
,
-
1
);
public
void
testMulTransposedMatMatBoolean
()
{
assertMatEqual
(
gray0
,
dst
);
Core
.
mulTransposed
(
grayE_32f
,
dst
,
true
);
}
assertMatEqual
(
grayE_32f
,
dst
);
}
public
void
testMulTransposedMatMatBoolean
()
{
Core
.
mulTransposed
(
grayE_32f
,
dst
,
true
);
public
void
testMulTransposedMatMatBooleanMat
()
{
assertMatEqual
(
grayE_32f
,
dst
);
Core
.
mulTransposed
(
grayRnd_32f
,
dst
,
true
,
grayRnd_32f
);
}
assertMatEqual
(
gray0_32f
,
dst
);
public
void
testMulTransposedMatMatBooleanMat
()
{
Mat
grayDelta
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Core
.
mulTransposed
(
grayRnd_32f
,
dst
,
true
,
grayRnd_32f
);
assertMatEqual
(
gray0_32f
,
dst
);
Mat
grayDelta
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayDelta
.
setTo
(
new
Scalar
(
0.0
));
grayDelta
.
setTo
(
new
Scalar
(
0.0
));
Core
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
);
Core
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
);
assertMatEqual
(
grayE_32f
,
dst
);
assertMatEqual
(
grayE_32f
,
dst
);
}
}
public
void
testMulTransposedMatMatBooleanMatDouble
()
{
public
void
testMulTransposedMatMatBooleanMatDouble
()
{
Mat
grayDelta
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
grayDelta
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayDelta
.
setTo
(
new
Scalar
(
0.0
));
grayDelta
.
setTo
(
new
Scalar
(
0.0
));
Core
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
,
1
);
Core
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
,
1
);
assertMatEqual
(
grayE_32f
,
dst
);
assertMatEqual
(
grayE_32f
,
dst
);
}
}
public
void
testMulTransposedMatMatBooleanMatDoubleInt
()
{
public
void
testMulTransposedMatMatBooleanMatDoubleInt
()
{
Mat
a
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
a
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
grayDelta
=
new
Mat
(
3
,
3
,
CvType
.
CV_8U
);
Mat
grayDelta
=
new
Mat
(
3
,
3
,
CvType
.
CV_8U
);
grayDelta
.
setTo
(
new
Scalar
(
0.0001
));
grayDelta
.
setTo
(
new
Scalar
(
0.0001
));
Mat
res
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
a
.
put
(
0
,
0
,
1
,
1
,
1
);
a
.
put
(
0
,
0
,
1
,
1
,
1
);
a
.
put
(
1
,
0
,
1
,
1
,
1
);
a
.
put
(
1
,
0
,
1
,
1
,
1
);
a
.
put
(
2
,
0
,
1
,
1
,
1
);
a
.
put
(
2
,
0
,
1
,
1
,
1
);
res
.
put
(
0
,
0
,
3
,
3
,
3
);
res
.
put
(
0
,
0
,
3
,
3
,
3
);
res
.
put
(
1
,
0
,
3
,
3
,
3
);
res
.
put
(
1
,
0
,
3
,
3
,
3
);
res
.
put
(
2
,
0
,
3
,
3
,
3
);
res
.
put
(
2
,
0
,
3
,
3
,
3
);
Core
.
mulTransposed
(
a
,
dst
,
true
,
grayDelta
,
1.0
,
1
);
Core
.
mulTransposed
(
a
,
dst
,
true
,
grayDelta
,
1.0
,
1
);
assertMatEqual
(
res
,
dst
);
assertMatEqual
(
res
,
dst
);
}
}
public
void
testNormalizeMatMat
()
{
public
void
testNormalizeMatMat
()
{
Core
.
normalize
(
gray0
,
dst
);
Core
.
normalize
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testNormalizeMatMatDouble
()
{
public
void
testNormalizeMatMatDouble
()
{
Core
.
normalize
(
gray0
,
dst
,
0.0
);
Core
.
normalize
(
gray0
,
dst
,
0.0
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testNormalizeMatMatDoubleDouble
()
{
public
void
testNormalizeMatMatDoubleDouble
()
{
Core
.
normalize
(
gray0
,
dst
,
0.0
,
1.0
);
Core
.
normalize
(
gray0
,
dst
,
0.0
,
1.0
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
}
public
void
testNormalizeMatMatDoubleDoubleInt
()
{
public
void
testNormalizeMatMatDoubleDoubleInt
()
{
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
Core
.
NORM_INF
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
Core
.
NORM_INF
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
}
}
public
void
testNormalizeMatMatDoubleDoubleIntInt
()
{
public
void
testNormalizeMatMatDoubleDoubleIntInt
()
{
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
Core
.
NORM_INF
,
-
1
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
Core
.
NORM_INF
,
-
1
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
}
}
public
void
testNormalizeMatMatDoubleDoubleIntIntMat
()
{
public
void
testNormalizeMatMatDoubleDoubleIntIntMat
()
{
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
src
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
mask
=
new
Mat
(
1
,
4
,
CvType
.
CV_8U
,
new
Scalar
(
1
));
Mat
mask
=
new
Mat
(
1
,
4
,
CvType
.
CV_8U
,
new
Scalar
(
1
));
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
Core
.
NORM_INF
,
-
1
,
mask
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
Core
.
NORM_INF
,
-
1
,
mask
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
}
}
public
void
testNormMat
()
{
public
void
testNormMat
()
{
double
n
=
Core
.
norm
(
gray0
);
double
n
=
Core
.
norm
(
gray0
);
assertTrue
(
0.0
==
n
);
assertTrue
(
0.0
==
n
);
}
}
public
void
testNormMatInt
()
{
public
void
testNormMatInt
()
{
double
n
=
Core
.
norm
(
gray127
,
Core
.
NORM_INF
);
double
n
=
Core
.
norm
(
gray127
,
Core
.
NORM_INF
);
assertTrue
(
127
==
n
);
assertTrue
(
127
==
n
);
}
}
public
void
testNormMatIntMat
()
{
public
void
testNormMatIntMat
()
{
double
n
=
Core
.
norm
(
gray3
,
Core
.
NORM_L1
,
gray0
);
double
n
=
Core
.
norm
(
gray3
,
Core
.
NORM_L1
,
gray0
);
assertEquals
(
0.0
,
n
);
assertEquals
(
0.0
,
n
);
}
}
public
void
testNormMatMat
()
{
public
void
testNormMatMat
()
{
double
n
=
Core
.
norm
(
gray255
,
gray255
);
double
n
=
Core
.
norm
(
gray255
,
gray255
);
assertEquals
(
0.0
,
n
);
assertEquals
(
0.0
,
n
);
}
}
public
void
testNormMatMatInt
()
{
public
void
testNormMatMatInt
()
{
double
n
=
Core
.
norm
(
gray127
,
gray0
,
Core
.
NORM_INF
);
double
n
=
Core
.
norm
(
gray127
,
gray0
,
Core
.
NORM_INF
);
assertEquals
(
127.0
,
n
);
assertEquals
(
127.0
,
n
);
}
}
public
void
testNormMatMatIntMat
()
{
public
void
testNormMatMatIntMat
()
{
double
n
=
Core
.
norm
(
gray3
,
gray0
,
Core
.
NORM_L1
,
gray0
);
double
n
=
Core
.
norm
(
gray3
,
gray0
,
Core
.
NORM_L1
,
gray0
);
assertEquals
(
0.0
,
n
);
assertEquals
(
0.0
,
n
);
}
}
public
void
testPCABackProject
()
{
public
void
testPCABackProject
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPCAComputeMatMatMat
()
{
public
void
testPCAComputeMatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPCAComputeMatMatMatInt
()
{
public
void
testPCAComputeMatMatMatInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPCAProject
()
{
public
void
testPCAProject
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPerspectiveTransform
()
{
public
void
testPerspectiveTransform
()
{
//
nice example
//
nice example
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPhaseMatMatMat
()
{
public
void
testPhaseMatMatMat
()
{
Mat
x
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
x
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
x
.
put
(
0
,
0
,
10.0
,
10.0
,
20.0
,
5.0
);
x
.
put
(
0
,
0
,
10.0
,
10.0
,
20.0
,
5.0
);
y
.
put
(
0
,
0
,
20.0
,
15.0
,
20.0
,
20.0
);
y
.
put
(
0
,
0
,
20.0
,
15.0
,
20.0
,
20.0
);
res
.
put
(
0
,
0
,
1.1071469
,
0.98280007
,
0.78539175
,
1.3258134
);
res
.
put
(
0
,
0
,
1.1071469
,
0.98280007
,
0.78539175
,
1.3258134
);
Core
.
phase
(
x
,
y
,
dst
);
Core
.
phase
(
x
,
y
,
dst
);
assertMatEqual
(
res
,
dst
);
assertMatEqual
(
res
,
dst
);
}
}
public
void
testPhaseMatMatMatBoolean
()
{
public
void
testPhaseMatMatMatBoolean
()
{
Mat
x
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
x
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
x
.
put
(
0
,
0
,
10.0
,
10.0
,
20.0
,
5.0
);
x
.
put
(
0
,
0
,
10.0
,
10.0
,
20.0
,
5.0
);
y
.
put
(
0
,
0
,
20.0
,
15.0
,
20.0
,
20.0
);
y
.
put
(
0
,
0
,
20.0
,
15.0
,
20.0
,
20.0
);
res
.
put
(
0
,
0
,
63.434
,
56.310
,
44.999
,
75.963
);
res
.
put
(
0
,
0
,
63.434
,
56.310
,
44.999
,
75.963
);
Core
.
phase
(
x
,
y
,
dst
,
true
);
Core
.
phase
(
x
,
y
,
dst
,
true
);
}
}
public
void
testPolarToCartMatMatMatMat
()
{
public
void
testPolarToCartMatMatMatMat
()
{
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
magnitude
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
angle
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
x
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
y
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
xCoordinate
=
new
Mat
();
Mat
xCoordinate
=
new
Mat
();
Mat
yCoordinate
=
new
Mat
();
Mat
yCoordinate
=
new
Mat
();
//
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);
//
y.put(0, 0, 4.0, 8.0, 12.0);
// magnitude.put(0, 0, 5.0, 10.0, 13.0);
// magnitude.put(0, 0, 5.0, 10.0, 13.0);
//
angle.put(0, 0, 0.92729962, 0.92729962, 1.1759995);
//
angle.put(0, 0, 0.92729962, 0.92729962, 1.1759995);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
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
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
//
TODO: needs epsilon comparison
//
TODO: needs epsilon comparison
Core
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
Core
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
assertMatEqual
(
x
,
xCoordinate
);
assertMatEqual
(
x
,
xCoordinate
);
}
}
public
void
testPolarToCartMatMatMatMatBoolean
()
{
public
void
testPolarToCartMatMatMatMatBoolean
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPolylinesMatListOfMatBooleanScalar
()
{
public
void
testPolylinesMatListOfMatBooleanScalar
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPolylinesMatListOfMatBooleanScalarInt
()
{
public
void
testPolylinesMatListOfMatBooleanScalarInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPolylinesMatListOfMatBooleanScalarIntInt
()
{
public
void
testPolylinesMatListOfMatBooleanScalarIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPolylinesMatListOfMatBooleanScalarIntIntInt
()
{
public
void
testPolylinesMatListOfMatBooleanScalarIntIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPow
()
{
public
void
testPow
()
{
Core
.
pow
(
gray3
,
2.0
,
dst
);
Core
.
pow
(
gray3
,
2.0
,
dst
);
assertMatEqual
(
gray9
,
dst
);
assertMatEqual
(
gray9
,
dst
);
}
}
public
void
testPutTextMatStringPointIntDoubleScalar
()
{
public
void
testPutTextMatStringPointIntDoubleScalar
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPutTextMatStringPointIntDoubleScalarInt
()
{
public
void
testPutTextMatStringPointIntDoubleScalarInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPutTextMatStringPointIntDoubleScalarIntInt
()
{
public
void
testPutTextMatStringPointIntDoubleScalarIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testPutTextMatStringPointIntDoubleScalarIntIntBoolean
()
{
public
void
testPutTextMatStringPointIntDoubleScalarIntIntBoolean
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRandn
()
{
public
void
testRandn
()
{
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
randn
(
gray0
,
low
,
high
);
Core
.
randn
(
gray0
,
low
,
high
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
}
public
void
testRandShuffleMat
()
{
public
void
testRandShuffleMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRandShuffleMatDouble
()
{
public
void
testRandShuffleMatDouble
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testRandu
()
{
public
void
testRandu
()
{
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
randu
(
gray0
,
low
,
high
);
Core
.
randu
(
gray0
,
low
,
high
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
}
public
void
testRectangleMatPointPointScalar
()
{
public
void
testRectangleMatPointPointScalar
()
{
Point
center
=
new
Point
(
gray0
.
cols
()/
2
,
gray0
.
rows
()/
2
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
origin
=
new
Point
(
0
,
0
);
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
);
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
}
public
void
testRectangleMatPointPointScalarInt
()
{
public
void
testRectangleMatPointPointScalarInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
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
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
);
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
}
public
void
testRectangleMatPointPointScalarIntInt
()
{
public
void
testRectangleMatPointPointScalarIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
()/
2
,
gray0
.
rows
()/
2
);
Point
center
=
new
Point
(
gray0
.
cols
()
/
2
,
gray0
.
rows
()
/
2
);
Point
origin
=
new
Point
(
0
,
0
);
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
8
);
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
8
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
}
public
void
testRectangleMatPointPointScalarIntIntInt
()
{
public
void
testRectangleMatPointPointScalarIntIntInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
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
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
==
Core
.
countNonZero
(
gray0
));
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
4
,
2
);
Core
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
4
,
2
);
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
Core
.
countNonZero
(
gray0
));
}
}
public
void
testReduceMatMatIntInt
()
{
public
void
testReduceMatMatIntInt
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
2
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
2
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
1
,
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
);
Core
.
reduce
(
src
,
dst
,
0
,
2
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
}
}
public
void
testReduceMatMatIntIntInt
()
{
public
void
testReduceMatMatIntIntInt
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
2
,
CvType
.
CV_32F
);
Mat
out
=
new
Mat
(
1
,
2
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
0
,
0
,
1
,
0
);
src
.
put
(
1
,
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
);
Core
.
reduce
(
src
,
dst
,
0
,
2
,
-
1
);
assertMatEqual
(
out
,
dst
);
assertMatEqual
(
out
,
dst
);
}
}
public
void
testRepeat
()
{
public
void
testRepeat
()
{
Mat
src
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
src
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
des1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
des1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
Mat
des2
=
new
Mat
(
1
,
6
,
CvType
.
CV_32F
);
Mat
des2
=
new
Mat
(
1
,
6
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1
,
2
,
3
);
src
.
put
(
0
,
0
,
1
,
2
,
3
);
des1
.
put
(
0
,
0
,
1
,
2
,
3
);
des1
.
put
(
0
,
0
,
1
,
2
,
3
);
des2
.
put
(
0
,
0
,
1
,
2
,
3
,
1
,
2
,
3
);
des2
.
put
(
0
,
0
,
1
,
2
,
3
,
1
,
2
,
3
);
Core
.
repeat
(
src
,
1
,
1
,
dst
);
Core
.
repeat
(
src
,
1
,
1
,
dst
);
assertMatEqual
(
des1
,
dst
);
assertMatEqual
(
des1
,
dst
);
Core
.
repeat
(
src
,
1
,
2
,
dst
);
Core
.
repeat
(
src
,
1
,
2
,
dst
);
assertMatEqual
(
des2
,
dst
);
assertMatEqual
(
des2
,
dst
);
}
}
public
void
testScaleAdd
()
{
public
void
testScaleAdd
()
{
Core
.
scaleAdd
(
gray3
,
2.0
,
gray3
,
dst
);
Core
.
scaleAdd
(
gray3
,
2.0
,
gray3
,
dst
);
assertMatEqual
(
dst
,
gray9
);
assertMatEqual
(
dst
,
gray9
);
}
}
public
void
testSetIdentityMat
()
{
public
void
testSetIdentityMat
()
{
Core
.
setIdentity
(
gray0_32f
);
Core
.
setIdentity
(
gray0_32f
);
assertMatEqual
(
grayE_32f
,
gray0_32f
);
assertMatEqual
(
grayE_32f
,
gray0_32f
);
}
}
public
void
testSetIdentityMatScalar
()
{
public
void
testSetIdentityMatScalar
()
{
Core
.
gemm
(
grayE_32f
,
grayE_32f
,
5.0
,
new
Mat
(),
0.0
,
dst
);
Core
.
gemm
(
grayE_32f
,
grayE_32f
,
5.0
,
new
Mat
(),
0.0
,
dst
);
Core
.
setIdentity
(
gray0_32f
,
new
Scalar
(
5
));
Core
.
setIdentity
(
gray0_32f
,
new
Scalar
(
5
));
assertMatEqual
(
dst
,
gray0_32f
);
assertMatEqual
(
dst
,
gray0_32f
);
}
}
public
void
testSolveCubic
()
{
public
void
testSolveCubic
()
{
Mat
coeffs
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
coeffs
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
coeffs
.
put
(
0
,
0
,
1
,
6
,
11
,
6
);
coeffs
.
put
(
0
,
0
,
1
,
6
,
11
,
6
);
roots
.
put
(
0
,
0
,
-
3
,
-
1
,
-
2
);
roots
.
put
(
0
,
0
,
-
3
,
-
1
,
-
2
);
Core
.
solveCubic
(
coeffs
,
dst
);
Core
.
solveCubic
(
coeffs
,
dst
);
assertMatEqual
(
roots
,
dst
);
assertMatEqual
(
roots
,
dst
);
}
}
public
void
testSolveMatMatMat
()
{
public
void
testSolveMatMatMat
()
{
Mat
a
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
a
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
b
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
b
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
a
.
put
(
0
,
0
,
1
,
1
,
1
);
a
.
put
(
0
,
0
,
1
,
1
,
1
);
a
.
put
(
1
,
0
,
1
,
-
2
,
2
);
a
.
put
(
1
,
0
,
1
,
-
2
,
2
);
a
.
put
(
2
,
0
,
1
,
2
,
1
);
a
.
put
(
2
,
0
,
1
,
2
,
1
);
b
.
put
(
0
,
0
,
0
,
4
,
2
);
b
.
put
(
0
,
0
,
0
,
4
,
2
);
res
.
put
(
0
,
0
,
-
12
,
2
,
10
);
res
.
put
(
0
,
0
,
-
12
,
2
,
10
);
Core
.
solve
(
a
,
b
,
dst
);
Core
.
solve
(
a
,
b
,
dst
);
assertMatEqual
(
res
,
dst
);
assertMatEqual
(
res
,
dst
);
}
}
public
void
testSolveMatMatMatInt
()
{
public
void
testSolveMatMatMatInt
()
{
Mat
a
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
a
=
new
Mat
(
3
,
3
,
CvType
.
CV_32F
);
Mat
b
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
b
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
res
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
a
.
put
(
0
,
0
,
1
,
1
,
1
);
a
.
put
(
0
,
0
,
1
,
1
,
1
);
a
.
put
(
1
,
0
,
1
,
-
2
,
2
);
a
.
put
(
1
,
0
,
1
,
-
2
,
2
);
a
.
put
(
2
,
0
,
1
,
2
,
1
);
a
.
put
(
2
,
0
,
1
,
2
,
1
);
b
.
put
(
0
,
0
,
0
,
4
,
2
);
b
.
put
(
0
,
0
,
0
,
4
,
2
);
res
.
put
(
0
,
0
,
-
12
,
2
,
10
);
res
.
put
(
0
,
0
,
-
12
,
2
,
10
);
Core
.
solve
(
a
,
b
,
dst
,
3
);
Core
.
solve
(
a
,
b
,
dst
,
3
);
assertMatEqual
(
res
,
dst
);
assertMatEqual
(
res
,
dst
);
}
}
public
void
testSolvePolyMatMat
()
{
public
void
testSolvePolyMatMat
()
{
Mat
coeffs
=
new
Mat
(
4
,
1
,
CvType
.
CV_32F
);
Mat
coeffs
=
new
Mat
(
4
,
1
,
CvType
.
CV_32F
);
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
truth
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
truth
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
truth
.
put
(
0
,
0
,
1
,
0
,
2
,
0
,
3
,
0
);
truth
.
put
(
0
,
0
,
1
,
0
,
2
,
0
,
3
,
0
);
Core
.
solvePoly
(
coeffs
,
roots
);
Core
.
solvePoly
(
coeffs
,
roots
);
assertMatEqual
(
truth
,
roots
);
assertMatEqual
(
truth
,
roots
);
}
}
public
void
testSolvePolyMatMatInt
()
{
public
void
testSolvePolyMatMatInt
()
{
Mat
coeffs
=
new
Mat
(
4
,
1
,
CvType
.
CV_32F
);
Mat
coeffs
=
new
Mat
(
4
,
1
,
CvType
.
CV_32F
);
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
truth
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
truth
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
truth
.
put
(
0
,
0
,
1
,
0
,
-
1
,
2
,
-
2
,
12
);
truth
.
put
(
0
,
0
,
1
,
0
,
-
1
,
2
,
-
2
,
12
);
Core
.
solvePoly
(
coeffs
,
roots
,
1
);
Core
.
solvePoly
(
coeffs
,
roots
,
1
);
assertMatEqual
(
truth
,
roots
);
assertMatEqual
(
truth
,
roots
);
}
}
public
void
testSort
()
{
public
void
testSort
()
{
Mat
submat
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
()
/
2
);
Mat
submat
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1.0
));
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
());
submat
=
dst
.
submat
(
0
,
dst
.
rows
()
/
2
,
dst
.
cols
()
/
2
,
dst
.
cols
());
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
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
);
submat
=
dst
.
submat
(
dst
.
rows
()
/
2
,
dst
.
rows
(),
0
,
dst
.
cols
()
/
2
);
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
}
}
public
void
testSortIdx
()
{
public
void
testSortIdx
()
{
Mat
a
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_8UC1
);
Mat
a
=
Mat
.
eye
(
3
,
3
,
CvType
.
CV_8UC1
);
Mat
b
=
new
Mat
();
Mat
b
=
new
Mat
();
truth
=
new
Mat
(
3
,
3
,
CvType
.
CV_32SC1
);
truth
=
new
Mat
(
3
,
3
,
CvType
.
CV_32SC1
);
truth
.
put
(
0
,
0
,
1
,
2
,
0
);
truth
.
put
(
0
,
0
,
1
,
2
,
0
);
truth
.
put
(
1
,
0
,
0
,
2
,
1
);
truth
.
put
(
1
,
0
,
0
,
2
,
1
);
truth
.
put
(
2
,
0
,
0
,
1
,
2
);
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
);
assertMatEqual
(
truth
,
b
);
}
}
public
void
testSplit
()
{
public
void
testSplit
()
{
ArrayList
<
Mat
>
cois
=
new
ArrayList
<
Mat
>();
ArrayList
<
Mat
>
cois
=
new
ArrayList
<
Mat
>();
Core
.
split
(
rgba0
,
cois
);
Core
.
split
(
rgba0
,
cois
);
for
(
Mat
coi
:
cois
)
{
for
(
Mat
coi
:
cois
)
{
assertMatEqual
(
gray0
,
coi
);
assertMatEqual
(
gray0
,
coi
);
}
}
}
}
public
void
testSqrt
()
{
public
void
testSqrt
()
{
Core
.
sqrt
(
gray9_32f
,
dst
);
Core
.
sqrt
(
gray9_32f
,
dst
);
assertMatEqual
(
gray3_32f
,
dst
);
assertMatEqual
(
gray3_32f
,
dst
);
Mat
rgba144
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32FC4
);
Mat
rgba144
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32FC4
);
Mat
rgba12
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32FC4
);
Mat
rgba12
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32FC4
);
rgba144
.
setTo
(
Scalar
.
all
(
144
));
rgba144
.
setTo
(
Scalar
.
all
(
144
));
rgba12
.
setTo
(
Scalar
.
all
(
12
));
rgba12
.
setTo
(
Scalar
.
all
(
12
));
Core
.
sqrt
(
rgba144
,
dst
);
Core
.
sqrt
(
rgba144
,
dst
);
assertMatEqual
(
rgba12
,
dst
);
assertMatEqual
(
rgba12
,
dst
);
}
}
public
void
testSubtractMatMatMat
()
{
public
void
testSubtractMatMatMat
()
{
Core
.
subtract
(
gray128
,
gray1
,
dst
);
Core
.
subtract
(
gray128
,
gray1
,
dst
);
assertMatEqual
(
gray127
,
dst
);
assertMatEqual
(
gray127
,
dst
);
}
}
public
void
testSubtractMatMatMatMat
()
{
public
void
testSubtractMatMatMatMat
()
{
Mat
mask
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
0
));
Mat
mask
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
0
));
Mat
submask
=
mask
.
submat
(
0
,
mask
.
rows
()
/
2
,
0
,
mask
.
cols
()
/
2
);
Mat
submask
=
mask
.
submat
(
0
,
mask
.
rows
()
/
2
,
0
,
mask
.
cols
()
/
2
);
submask
.
setTo
(
new
Scalar
(
1
));
submask
.
setTo
(
new
Scalar
(
1
));
dst
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
0
));
dst
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
0
));
Core
.
subtract
(
gray3
,
gray2
,
dst
,
mask
);
Core
.
subtract
(
gray3
,
gray2
,
dst
,
mask
);
assertTrue
(
submask
.
total
()
==
Core
.
countNonZero
(
dst
));
assertTrue
(
submask
.
total
()
==
Core
.
countNonZero
(
dst
));
}
}
public
void
testSubtractMatMatMatMatInt
()
{
public
void
testSubtractMatMatMatMatInt
()
{
Core
.
subtract
(
gray3
,
gray2
,
dst
,
gray1
,
CvType
.
CV_32F
);
Core
.
subtract
(
gray3
,
gray2
,
dst
,
gray1
,
CvType
.
CV_32F
);
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertMatEqual
(
gray1_32f
,
dst
);
assertMatEqual
(
gray1_32f
,
dst
);
}
}
public
void
testSumElems
()
{
public
void
testSumElems
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSVBackSubst
()
{
public
void
testSVBackSubst
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSVDecompMatMatMatMat
()
{
public
void
testSVDecompMatMatMatMat
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testSVDecompMatMatMatMatInt
()
{
public
void
testSVDecompMatMatMatMatInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testTrace
()
{
public
void
testTrace
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testTransform
()
{
public
void
testTransform
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
,
new
Scalar
(
55
));
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
,
new
Scalar
(
55
));
Mat
m
=
Mat
.
eye
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m
=
Mat
.
eye
(
2
,
2
,
CvType
.
CV_32FC1
);
Core
.
transform
(
src
,
dst
,
m
);
Core
.
transform
(
src
,
dst
,
m
);
truth
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC2
,
new
Scalar
(
55
,
1
));
truth
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC2
,
new
Scalar
(
55
,
1
));
assertMatEqual
(
truth
,
dst
);
assertMatEqual
(
truth
,
dst
);
}
}
public
void
testTranspose
()
{
public
void
testTranspose
()
{
Mat
subgray0
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
());
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
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
Mat
subdst
=
destination
.
submat
(
0
,
destination
.
rows
(),
0
,
destination
.
cols
()
/
2
);
destination
.
setTo
(
new
Scalar
(
0
));
subgray0
.
setTo
(
new
Scalar
(
1
));
Mat
subdst
=
destination
.
submat
(
0
,
destination
.
rows
(),
0
,
Core
.
transpose
(
gray0
,
destination
);
destination
.
cols
()
/
2
);
assertTrue
(
subdst
.
total
()
==
Core
.
countNonZero
(
subdst
));
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