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
6b789dd2
Commit
6b789dd2
authored
Jul 19, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java tests: adopted for the new package structure
parent
dfdb15be
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
278 additions
and
278 deletions
+278
-278
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+11
-11
calib3dTest.java
...android_test/src/org/opencv/test/calib3d/calib3dTest.java
+13
-13
MatTest.java
...s/java/android_test/src/org/opencv/test/core/MatTest.java
+3
-3
RotatedRectTest.java
...ndroid_test/src/org/opencv/test/core/RotatedRectTest.java
+4
-4
coreTest.java
.../java/android_test/src/org/opencv/test/core/coreTest.java
+195
-195
VideoCaptureTest.java
...id_test/src/org/opencv/test/highgui/VideoCaptureTest.java
+15
-15
highguiTest.java
...android_test/src/org/opencv/test/highgui/highguiTest.java
+3
-3
imgprocTest.java
...android_test/src/org/opencv/test/imgproc/imgprocTest.java
+16
-16
CascadeClassifierTest.java
.../src/org/opencv/test/objdetect/CascadeClassifierTest.java
+5
-5
objdetectTest.java
...oid_test/src/org/opencv/test/objdetect/objdetectTest.java
+4
-4
videoTest.java
...ava/android_test/src/org/opencv/test/video/videoTest.java
+9
-9
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
6b789dd2
...
...
@@ -2,11 +2,11 @@ package org.opencv.test;
import
junit.framework.TestCase
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Scalar
;
import
org.opencv.core
;
import
org.opencv.highgui
;
import
org.opencv.
core.
CvType
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Scalar
;
import
org.opencv.core
.Core
;
import
org.opencv.highgui
.Highgui
;
public
class
OpenCVTestCase
extends
TestCase
{
...
...
@@ -85,7 +85,7 @@ public class OpenCVTestCase extends TestCase {
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
grayRnd
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
c
ore
.
randu
(
grayRnd
,
low
,
high
);
grayRnd
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
C
ore
.
randu
(
grayRnd
,
low
,
high
);
gray0_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
0.0
));
gray1_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
1.0
));
...
...
@@ -93,7 +93,7 @@ public class OpenCVTestCase extends TestCase {
gray9_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
9.0
));
gray255_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
255.0
));
grayE_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayE_32f
=
Mat
.
eye
(
matSize
,
matSize
,
CvType
.
CV_32FC1
);
grayRnd_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
c
ore
.
randu
(
grayRnd_32f
,
low
,
high
);
grayRnd_32f
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
C
ore
.
randu
(
grayRnd_32f
,
low
,
high
);
gray0_32f_1d
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
,
new
Scalar
(
0.0
));
...
...
@@ -103,8 +103,8 @@ public class OpenCVTestCase extends TestCase {
rgba0
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC4
,
Scalar
.
all
(
0
));
rgba128
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC4
,
Scalar
.
all
(
128
));
rgbLena
=
h
ighgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
grayChess
=
h
ighgui
.
imread
(
OpenCVTestRunner
.
CHESS_PATH
);
rgbLena
=
H
ighgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
grayChess
=
H
ighgui
.
imread
(
OpenCVTestRunner
.
CHESS_PATH
);
v1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v1
.
put
(
0
,
0
,
1.0
,
3.0
,
2.0
);
v2
=
new
Mat
(
1
,
3
,
CvType
.
CV_32F
);
v2
.
put
(
0
,
0
,
2.0
,
1.0
,
3.0
);
...
...
@@ -163,9 +163,9 @@ public class OpenCVTestCase extends TestCase {
static
private
double
CalcPercentageOfDifference
(
Mat
m1
,
Mat
m2
)
{
Mat
cmp
=
new
Mat
(
0
,
0
,
CvType
.
CV_8U
);
core
.
compare
(
m1
,
m2
,
cmp
,
c
ore
.
CMP_EQ
);
Core
.
compare
(
m1
,
m2
,
cmp
,
C
ore
.
CMP_EQ
);
double
difference
=
100.0
*
(
1.0
-
Double
.
valueOf
(
c
ore
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
(
1.0
-
Double
.
valueOf
(
C
ore
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
return
difference
;
}
...
...
modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java
View file @
6b789dd2
package
org
.
opencv
.
test
.
calib3d
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Point
;
import
org.opencv.Scalar
;
import
org.opencv.Size
;
import
org.opencv.calib3d
;
import
org.opencv.core
;
import
org.opencv.
core.
CvType
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Point
;
import
org.opencv.
core.
Scalar
;
import
org.opencv.
core.
Size
;
import
org.opencv.calib3d
.Calib3d
;
import
org.opencv.core
.Core
;
import
org.opencv.test.OpenCVTestCase
;
public
class
calib3dTest
extends
OpenCVTestCase
{
...
...
@@ -27,7 +27,7 @@ public class calib3dTest extends OpenCVTestCase {
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
);
c
alib3d
.
composeRT
(
rvec1
,
tvec1
,
rvec2
,
tvec2
,
rvec3
,
tvec3
);
C
alib3d
.
composeRT
(
rvec1
,
tvec1
,
rvec2
,
tvec2
,
rvec3
,
tvec3
);
assertMatEqual
(
outRvec
,
rvec3
);
assertMatEqual
(
outTvec
,
tvec3
);
...
...
@@ -145,10 +145,10 @@ public class calib3dTest extends OpenCVTestCase {
public
void
testFilterSpecklesMatDoubleIntDouble
()
{
gray_16s_1024
.
copyTo
(
dst
);
Point
center
=
new
Point
(
gray_16s_1024
.
rows
()/
2
.,
gray_16s_1024
.
cols
()/
2
.);
c
ore
.
circle
(
dst
,
center
,
1
,
Scalar
.
all
(
4096
));
C
ore
.
circle
(
dst
,
center
,
1
,
Scalar
.
all
(
4096
));
assertMatNotEqual
(
gray_16s_1024
,
dst
);
c
alib3d
.
filterSpeckles
(
dst
,
1024.0
,
100
,
0
.);
C
alib3d
.
filterSpeckles
(
dst
,
1024.0
,
100
,
0
.);
assertMatEqual
(
gray_16s_1024
,
dst
);
}
...
...
@@ -158,14 +158,14 @@ public class calib3dTest extends OpenCVTestCase {
public
void
testFindChessboardCornersMatSizeMat
()
{
Size
patternSize
=
new
Size
(
9
,
6
);
c
alib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
);
C
alib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
);
assertTrue
(!
dst
.
empty
());
}
public
void
testFindChessboardCornersMatSizeMatInt
()
{
Size
patternSize
=
new
Size
(
9
,
6
);
c
alib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
,
calib3d
.
CALIB_CB_ADAPTIVE_THRESH
+
calib3d
.
CALIB_CB_NORMALIZE_IMAGE
+
c
alib3d
.
CALIB_CB_FAST_CHECK
);
C
alib3d
.
findChessboardCorners
(
grayChess
,
patternSize
,
dst
,
Calib3d
.
CALIB_CB_ADAPTIVE_THRESH
+
Calib3d
.
CALIB_CB_NORMALIZE_IMAGE
+
C
alib3d
.
CALIB_CB_FAST_CHECK
);
assertTrue
(!
dst
.
empty
());
}
...
...
modules/java/android_test/src/org/opencv/test/core/MatTest.java
View file @
6b789dd2
package
org
.
opencv
.
test
.
core
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Scalar
;
import
org.opencv.
core.
CvType
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Scalar
;
import
org.opencv.test.OpenCVTestCase
;
public
class
MatTest
extends
OpenCVTestCase
{
...
...
modules/java/android_test/src/org/opencv/test/core/RotatedRectTest.java
View file @
6b789dd2
package
org
.
opencv
.
test
.
core
;
import
org.opencv.Point
;
import
org.opencv.Rect
;
import
org.opencv.RotatedRect
;
import
org.opencv.Size
;
import
org.opencv.
core.
Point
;
import
org.opencv.
core.
Rect
;
import
org.opencv.
core.
RotatedRect
;
import
org.opencv.
core.
Size
;
import
org.opencv.test.OpenCVTestCase
;
public
class
RotatedRectTest
extends
OpenCVTestCase
{
...
...
modules/java/android_test/src/org/opencv/test/core/coreTest.java
View file @
6b789dd2
...
...
@@ -2,12 +2,12 @@ package org.opencv.test.core;
import
java.util.ArrayList
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Point
;
import
org.opencv.Rect
;
import
org.opencv.Scalar
;
import
org.opencv.core
;
import
org.opencv.
core.
CvType
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Point
;
import
org.opencv.
core.
Rect
;
import
org.opencv.
core.
Scalar
;
import
org.opencv.core
.Core
;
import
org.opencv.test.OpenCVTestCase
;
public
class
coreTest
extends
OpenCVTestCase
{
...
...
@@ -17,78 +17,78 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testAbsdiff
()
{
c
ore
.
absdiff
(
gray128
,
gray255
,
dst
);
C
ore
.
absdiff
(
gray128
,
gray255
,
dst
);
assertMatEqual
(
gray127
,
dst
);
}
public
void
testAddMatMatMat
()
{
c
ore
.
add
(
gray128
,
gray128
,
dst
);
C
ore
.
add
(
gray128
,
gray128
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testAddMatMatMatMat
()
{
c
ore
.
add
(
gray0
,
gray1
,
dst
,
gray1
);
C
ore
.
add
(
gray0
,
gray1
,
dst
,
gray1
);
assertMatEqual
(
gray1
,
dst
);
dst
.
setTo
(
new
Scalar
(
127
));
c
ore
.
add
(
gray0
,
gray1
,
dst
,
gray0
);
C
ore
.
add
(
gray0
,
gray1
,
dst
,
gray0
);
assertMatEqual
(
gray127
,
dst
);
}
public
void
testAddMatMatMatMatInt
()
{
c
ore
.
add
(
gray0
,
gray1
,
dst
,
gray1
,
CvType
.
CV_32F
);
C
ore
.
add
(
gray0
,
gray1
,
dst
,
gray1
,
CvType
.
CV_32F
);
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertMatEqual
(
gray1_32f
,
dst
);
}
public
void
testAddWeightedMatDoubleMatDoubleDoubleMat
()
{
c
ore
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
);
C
ore
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testAddWeightedMatDoubleMatDoubleDoubleMatInt
()
{
c
ore
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
,
CvType
.
CV_32F
);
C
ore
.
addWeighted
(
gray1
,
126.0
,
gray127
,
1.0
,
2.0
,
dst
,
CvType
.
CV_32F
);
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertMatEqual
(
gray255_32f
,
dst
);
}
public
void
testBitwise_andMatMatMat
()
{
c
ore
.
bitwise_and
(
gray3
,
gray2
,
dst
);
C
ore
.
bitwise_and
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
}
public
void
testBitwise_andMatMatMatMat
()
{
c
ore
.
bitwise_and
(
gray0
,
gray1
,
dst
,
gray255
);
C
ore
.
bitwise_and
(
gray0
,
gray1
,
dst
,
gray255
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testBitwise_notMatMat
()
{
c
ore
.
bitwise_not
(
gray255
,
dst
);
C
ore
.
bitwise_not
(
gray255
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testBitwise_notMatMatMat
()
{
c
ore
.
bitwise_not
(
gray255
,
dst
,
gray255
);
C
ore
.
bitwise_not
(
gray255
,
dst
,
gray255
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testBitwise_orMatMatMat
()
{
c
ore
.
bitwise_or
(
gray3
,
gray2
,
dst
);
C
ore
.
bitwise_or
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray3
,
dst
);
}
public
void
testBitwise_orMatMatMatMat
()
{
c
ore
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
C
ore
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testBitwise_xorMatMatMat
()
{
c
ore
.
bitwise_xor
(
gray3
,
gray2
,
dst
);
C
ore
.
bitwise_xor
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray1
,
dst
);
}
public
void
testBitwise_xorMatMatMatMat
()
{
c
ore
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
C
ore
.
bitwise_or
(
gray127
,
gray128
,
dst
,
gray255
);
assertMatEqual
(
gray255
,
dst
);
}
...
...
@@ -96,7 +96,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_64FC1
);
c
ore
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
);
C
ore
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
);
assertMatEqual
(
gray0_64f
,
covar
);
assertMatEqual
(
gray0_64f_1d
,
mean
);
}
...
...
@@ -105,7 +105,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
c
ore
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
C
ore
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0_32f
,
covar
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
}
...
...
@@ -122,7 +122,7 @@ public class coreTest extends OpenCVTestCase {
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
Mat
dst_angle
=
new
Mat
();
c
ore
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
);
C
ore
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
);
assertMatEqual
(
magnitude
,
dst
);
assertMatEqual
(
angle
,
dst_angle
);
}
...
...
@@ -140,7 +140,7 @@ public class coreTest extends OpenCVTestCase {
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
Mat
dst_angle
=
new
Mat
();
c
ore
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
C
ore
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
assertMatEqual
(
magnitude
,
dst
);
assertMatEqual
(
angle
,
dst_angle
);
}
...
...
@@ -150,9 +150,9 @@ public class coreTest extends OpenCVTestCase {
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
circle
(
gray0
,
center
,
radius
,
color
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
circle
(
gray0
,
center
,
radius
,
color
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testCircleMatPointIntScalarInt
()
{
...
...
@@ -160,9 +160,9 @@ public class coreTest extends OpenCVTestCase {
int
radius
=
Math
.
min
(
gray0
.
cols
()/
4
,
gray0
.
rows
()/
4
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
circle
(
gray0
,
center
,
radius
,
color
,
-
1
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
circle
(
gray0
,
center
,
radius
,
color
,
-
1
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testCircleMatPointIntScalarIntInt
()
{
...
...
@@ -182,7 +182,7 @@ public class coreTest extends OpenCVTestCase {
Point
pt1Clipped
=
new
Point
(
10.0
,
15.0
);
Point
pt2Clipped
=
new
Point
(
19.0
,
15.0
);
boolean
res
=
c
ore
.
clipLine
(
r
,
pt1
,
pt2
);
boolean
res
=
C
ore
.
clipLine
(
r
,
pt1
,
pt2
);
assertEquals
(
true
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
assertEquals
(
pt2Clipped
,
pt2
);
...
...
@@ -192,72 +192,72 @@ public class coreTest extends OpenCVTestCase {
pt1Clipped
=
new
Point
(
5.0
,
5.0
);
pt2Clipped
=
new
Point
(
25.0
,
5.0
);
res
=
c
ore
.
clipLine
(
r
,
pt1
,
pt2
);
res
=
C
ore
.
clipLine
(
r
,
pt1
,
pt2
);
assertEquals
(
false
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
assertEquals
(
pt2Clipped
,
pt2
);
}
public
void
testCompare
()
{
core
.
compare
(
gray0
,
gray0
,
dst
,
c
ore
.
CMP_EQ
);
Core
.
compare
(
gray0
,
gray0
,
dst
,
C
ore
.
CMP_EQ
);
assertMatEqual
(
dst
,
gray255
);
core
.
compare
(
gray0
,
gray1
,
dst
,
c
ore
.
CMP_EQ
);
Core
.
compare
(
gray0
,
gray1
,
dst
,
C
ore
.
CMP_EQ
);
assertMatEqual
(
dst
,
gray0
);
core
.
compare
(
gray0
,
grayRnd
,
dst
,
c
ore
.
CMP_EQ
);
double
nBlackPixels
=
c
ore
.
countNonZero
(
dst
);
double
nNonBlackpixels
=
c
ore
.
countNonZero
(
grayRnd
);
Core
.
compare
(
gray0
,
grayRnd
,
dst
,
C
ore
.
CMP_EQ
);
double
nBlackPixels
=
C
ore
.
countNonZero
(
dst
);
double
nNonBlackpixels
=
C
ore
.
countNonZero
(
grayRnd
);
assertTrue
((
nBlackPixels
+
nNonBlackpixels
)
==
grayRnd
.
total
());
}
public
void
testCompleteSymmMat
()
{
c
ore
.
completeSymm
(
grayRnd_32f
);
c
ore
.
transpose
(
grayRnd_32f
,
dst
);
C
ore
.
completeSymm
(
grayRnd_32f
);
C
ore
.
transpose
(
grayRnd_32f
,
dst
);
assertMatEqual
(
grayRnd_32f
,
dst
);
}
public
void
testCompleteSymmMatBoolean
()
{
c
ore
.
completeSymm
(
grayRnd_32f
,
true
);
c
ore
.
transpose
(
grayRnd_32f
,
dst
);
C
ore
.
completeSymm
(
grayRnd_32f
,
true
);
C
ore
.
transpose
(
grayRnd_32f
,
dst
);
assertMatEqual
(
grayRnd_32f
,
dst
);
}
public
void
testConvertScaleAbsMatMat
()
{
c
ore
.
convertScaleAbs
(
gray0
,
dst
);
C
ore
.
convertScaleAbs
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
c
ore
.
convertScaleAbs
(
gray_16u_256
,
dst
);
C
ore
.
convertScaleAbs
(
gray_16u_256
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testConvertScaleAbsMatMatDouble
()
{
c
ore
.
convertScaleAbs
(
gray0
,
dst
,
2
);
C
ore
.
convertScaleAbs
(
gray0
,
dst
,
2
);
assertMatEqual
(
gray0
,
dst
);
c
ore
.
convertScaleAbs
(
gray_16u_256
,
dst
,
1
);
C
ore
.
convertScaleAbs
(
gray_16u_256
,
dst
,
1
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testConvertScaleAbsMatMatDoubleDouble
()
{
c
ore
.
convertScaleAbs
(
gray_16u_256
,
dst
,
2
,
2
);
C
ore
.
convertScaleAbs
(
gray_16u_256
,
dst
,
2
,
2
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testCountNonZero
()
{
assertEquals
(
0
,
c
ore
.
countNonZero
(
gray0
));
assertEquals
(
0
,
C
ore
.
countNonZero
(
gray0
));
gray0
.
put
(
0
,
0
,
255
);
gray0
.
put
(
gray0
.
rows
()
-
1
,
gray0
.
cols
()
-
1
,
255
);
assertEquals
(
2
,
c
ore
.
countNonZero
(
gray0
));
assertEquals
(
2
,
C
ore
.
countNonZero
(
gray0
));
}
public
void
testCubeRoot
()
{
float
res
=
c
ore
.
cubeRoot
(
27.0f
);
float
res
=
C
ore
.
cubeRoot
(
27.0f
);
assertEquals
(
3.0f
,
res
);
}
public
void
testDctMatMat
()
{
c
ore
.
dct
(
gray0_32f_1d
,
dst
);
C
ore
.
dct
(
gray0_32f_1d
,
dst
);
assertMatEqual
(
gray0_32f_1d
,
dst
);
Mat
in
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
...
...
@@ -265,12 +265,12 @@ public class coreTest extends OpenCVTestCase {
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
out
.
put
(
0
,
0
,
247.98576
,
-
61.252407
,
94.904533
,
14.013477
);
c
ore
.
dct
(
in
,
dst
);
C
ore
.
dct
(
in
,
dst
);
assertMatEqual
(
out
,
dst
);
}
public
void
testDctMatMatInt
()
{
c
ore
.
dct
(
gray0_32f_1d
,
dst
);
C
ore
.
dct
(
gray0_32f_1d
,
dst
);
assertMatEqual
(
gray0_32f_1d
,
dst
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
...
...
@@ -279,7 +279,7 @@ public class coreTest extends OpenCVTestCase {
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
);
c
ore
.
dct
(
in
,
dst
);
C
ore
.
dct
(
in
,
dst
);
assertMatEqual
(
truth
,
dst
);
}
...
...
@@ -290,7 +290,7 @@ public class coreTest extends OpenCVTestCase {
mat
.
put
(
1
,
0
,
4.0
);
mat
.
put
(
1
,
1
,
4.0
);
double
det
=
c
ore
.
determinant
(
mat
);
double
det
=
C
ore
.
determinant
(
mat
);
assertEquals
(
8.0
,
det
);
}
...
...
@@ -300,7 +300,7 @@ public class coreTest extends OpenCVTestCase {
truth
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
0
,
0
,
0
,
0
);
c
ore
.
dft
(
src
,
dst
);
C
ore
.
dft
(
src
,
dst
);
assertMatEqual
(
truth
,
dst
);
}
...
...
@@ -311,10 +311,10 @@ public class coreTest extends OpenCVTestCase {
src
.
put
(
0
,
0
,
1
,
2
,
3
,
4
);
out
.
put
(
0
,
0
,
10
,
-
2
,
2
,
-
2
);
core
.
dft
(
src
,
dst
,
c
ore
.
DFT_REAL_OUTPUT
);
Core
.
dft
(
src
,
dst
,
C
ore
.
DFT_REAL_OUTPUT
);
assertMatEqual
(
out
,
dst
);
core
.
dft
(
src
,
dst
,
c
ore
.
DFT_INVERSE
);
Core
.
dft
(
src
,
dst
,
C
ore
.
DFT_INVERSE
);
out2
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
assertMatEqual
(
out2
,
dst
);
}
...
...
@@ -325,32 +325,32 @@ public class coreTest extends OpenCVTestCase {
src
.
put
(
0
,
0
,
1
,
2
,
3
,
4
);
out
.
put
(
0
,
0
,
10
,
-
2
,
2
,
-
2
);
core
.
dft
(
src
,
dst
,
c
ore
.
DFT_REAL_OUTPUT
,
1
);
Core
.
dft
(
src
,
dst
,
C
ore
.
DFT_REAL_OUTPUT
,
1
);
assertMatEqual
(
out
,
dst
);
}
public
void
testDivideDoubleMatMat
()
{
c
ore
.
divide
(
4.0
,
gray2
,
dst
);
C
ore
.
divide
(
4.0
,
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
}
public
void
testDivideDoubleMatMatInt
()
{
c
ore
.
divide
(
9.0
,
gray3
,
dst
,
-
1
);
C
ore
.
divide
(
9.0
,
gray3
,
dst
,
-
1
);
assertMatEqual
(
gray3
,
dst
);
}
public
void
testDivideMatMatMat
()
{
c
ore
.
divide
(
gray2
,
gray1
,
dst
);
C
ore
.
divide
(
gray2
,
gray1
,
dst
);
assertMatEqual
(
gray2
,
dst
);
}
public
void
testDivideMatMatMatDouble
()
{
c
ore
.
divide
(
gray2
,
gray2
,
dst
,
2.0
);
C
ore
.
divide
(
gray2
,
gray2
,
dst
,
2.0
);
assertMatEqual
(
gray2
,
dst
);
}
public
void
testDivideMatMatMatDoubleInt
()
{
c
ore
.
divide
(
gray3
,
gray2
,
dst
,
2.0
,
gray3
.
depth
());
C
ore
.
divide
(
gray3
,
gray2
,
dst
,
2.0
,
gray3
.
depth
());
assertMatEqual
(
gray3
,
dst
);
}
...
...
@@ -388,21 +388,21 @@ public class coreTest extends OpenCVTestCase {
public
void
testExp
()
{
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
destination
.
setTo
(
new
Scalar
(
0.0
));
c
ore
.
exp
(
gray0_32f
,
destination
);
C
ore
.
exp
(
gray0_32f
,
destination
);
assertMatEqual
(
gray1_32f
,
destination
);
}
public
void
testExtractChannel
()
{
c
ore
.
extractChannel
(
rgba128
,
dst
,
0
);
C
ore
.
extractChannel
(
rgba128
,
dst
,
0
);
assertMatEqual
(
gray128
,
dst
);
}
public
void
testFastAtan2
()
{
double
delta
=
0.01
;
float
res
=
c
ore
.
fastAtan2
(
50
,
50
);
float
res
=
C
ore
.
fastAtan2
(
50
,
50
);
assertEquals
(
45
,
res
,
delta
);
float
res2
=
c
ore
.
fastAtan2
(
80
,
20
);
float
res2
=
C
ore
.
fastAtan2
(
80
,
20
);
assertEquals
(
75.96
,
res2
,
delta
);
}
...
...
@@ -418,7 +418,7 @@ public class coreTest extends OpenCVTestCase {
des_f0
.
put
(
0
,
1
,
4.0
);
des_f0
.
put
(
1
,
0
,
1.0
);
des_f0
.
put
(
1
,
1
,
2.0
);
c
ore
.
flip
(
src
,
dst
,
0
);
C
ore
.
flip
(
src
,
dst
,
0
);
assertMatEqual
(
des_f0
,
dst
);
Mat
des_f1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
);
...
...
@@ -426,7 +426,7 @@ public class coreTest extends OpenCVTestCase {
des_f1
.
put
(
0
,
1
,
1.0
);
des_f1
.
put
(
1
,
0
,
4.0
);
des_f1
.
put
(
1
,
1
,
3.0
);
c
ore
.
flip
(
src
,
dst
,
1
);
C
ore
.
flip
(
src
,
dst
,
1
);
assertMatEqual
(
des_f1
,
dst
);
}
...
...
@@ -448,7 +448,7 @@ public class coreTest extends OpenCVTestCase {
desired
.
put
(
0
,
0
,
1.001
,
0.001
);
desired
.
put
(
1
,
0
,
1.001
,
0.001
);
c
ore
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
);
C
ore
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
);
assertMatEqual
(
desired
,
dst
);
}
...
...
@@ -470,17 +470,17 @@ public class coreTest extends OpenCVTestCase {
desired
.
put
(
0
,
0
,
2.001
,
0.001
);
desired
.
put
(
1
,
0
,
0.001
,
0.001
);
core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
,
c
ore
.
GEMM_1_T
);
Core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
,
C
ore
.
GEMM_1_T
);
assertMatEqual
(
desired
,
dst
);
}
public
void
testGetOptimalDFTSize
()
{
int
vecsize
=
c
ore
.
getOptimalDFTSize
(
0
);
int
vecsize
=
C
ore
.
getOptimalDFTSize
(
0
);
assertEquals
(
1
,
vecsize
);
int
largeVecSize
=
c
ore
.
getOptimalDFTSize
(
133
);
int
largeVecSize
=
C
ore
.
getOptimalDFTSize
(
133
);
assertEquals
(
135
,
largeVecSize
);
largeVecSize
=
c
ore
.
getOptimalDFTSize
(
13
);
largeVecSize
=
C
ore
.
getOptimalDFTSize
(
13
);
assertEquals
(
15
,
largeVecSize
);
}
...
...
@@ -490,7 +490,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testGetTickFrequency
()
{
double
freq
=
0.0
;
freq
=
c
ore
.
getTickFrequency
();
freq
=
C
ore
.
getTickFrequency
();
assertTrue
(
0.0
!=
freq
);
}
...
...
@@ -499,7 +499,7 @@ public class coreTest extends OpenCVTestCase {
Mat
eConcat
=
new
Mat
(
1
,
9
,
CvType
.
CV_8UC1
);
eConcat
.
put
(
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
);
c
ore
.
hconcat
(
e
,
dst
);
C
ore
.
hconcat
(
e
,
dst
);
assertMatEqual
(
eConcat
,
dst
);
}
...
...
@@ -509,7 +509,7 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
out
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
c
ore
.
idct
(
in
,
dst
);
C
ore
.
idct
(
in
,
dst
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -520,7 +520,7 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
1.0
,
0.0
,
1.0
,
2.0
,
3.0
,
1.0
);
out
.
put
(
0
,
0
,
3.3769724
,
-
1.6215782
,
2.3608727
,
0.20730907
,
-
0.86502546
,
0.028082132
,
-
0.7673766
,
0.10917115
);
core
.
idct
(
in
,
dst
,
c
ore
.
DCT_ROWS
);
Core
.
idct
(
in
,
dst
,
C
ore
.
DCT_ROWS
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -531,7 +531,7 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
c
ore
.
idft
(
in
,
dst
);
C
ore
.
idft
(
in
,
dst
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -541,7 +541,7 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
core
.
idft
(
in
,
dst
,
c
ore
.
DFT_REAL_OUTPUT
);
Core
.
idft
(
in
,
dst
,
C
ore
.
DFT_REAL_OUTPUT
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -551,20 +551,20 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
9
,
-
9
,
1
,
3
);
core
.
idft
(
in
,
dst
,
c
ore
.
DFT_REAL_OUTPUT
,
1
);
Core
.
idft
(
in
,
dst
,
C
ore
.
DFT_REAL_OUTPUT
,
1
);
assertMatEqual
(
out
,
dst
);
}
public
void
testInRange
()
{
c
ore
.
inRange
(
gray0
,
gray0
,
gray1
,
dst
);
C
ore
.
inRange
(
gray0
,
gray0
,
gray1
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testInsertChannel
()
{
c
ore
.
insertChannel
(
gray0
,
rgba128
,
0
);
c
ore
.
insertChannel
(
gray0
,
rgba128
,
1
);
c
ore
.
insertChannel
(
gray0
,
rgba128
,
2
);
c
ore
.
insertChannel
(
gray0
,
rgba128
,
3
);
C
ore
.
insertChannel
(
gray0
,
rgba128
,
0
);
C
ore
.
insertChannel
(
gray0
,
rgba128
,
1
);
C
ore
.
insertChannel
(
gray0
,
rgba128
,
2
);
C
ore
.
insertChannel
(
gray0
,
rgba128
,
3
);
assertMatEqual
(
rgba0
,
rgba128
);
}
...
...
@@ -581,13 +581,13 @@ public class coreTest extends OpenCVTestCase {
answer
.
put
(
1
,
0
,
-
1.5
);
answer
.
put
(
1
,
1
,
1.0
);
c
ore
.
invert
(
src
,
dst
);
C
ore
.
invert
(
src
,
dst
);
assertMatEqual
(
answer
,
dst
);
//TODO: needs epsilon comparison
// Mat m = grayRnd_32f.clone();
// Mat inv = m.inv();
//
c
ore.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
//
C
ore.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
// assertMatEqual(grayE_32f, dst);
}
...
...
@@ -602,11 +602,11 @@ public class coreTest extends OpenCVTestCase {
out
.
put
(
1
,
0
,
0
,
1
,
0
);
out
.
put
(
2
,
0
,
0
,
0
,
1
);
core
.
invert
(
src
,
dst
,
c
ore
.
DECOMP_CHOLESKY
);
Core
.
invert
(
src
,
dst
,
C
ore
.
DECOMP_CHOLESKY
);
assertMatEqual
(
out
,
dst
);
core
.
invert
(
src
,
dst
,
c
ore
.
DECOMP_LU
);
double
det
=
c
ore
.
determinant
(
src
);
Core
.
invert
(
src
,
dst
,
C
ore
.
DECOMP_LU
);
double
det
=
C
ore
.
determinant
(
src
);
assertTrue
(
det
>
0.0
);
}
...
...
@@ -625,9 +625,9 @@ public class coreTest extends OpenCVTestCase {
Point
point2
=
new
Point
(
nPoints
,
nPoints
);
Scalar
color
=
new
Scalar
(
255
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
line
(
gray0
,
point1
,
point2
,
color
);
assertTrue
(
nPoints
==
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
line
(
gray0
,
point1
,
point2
,
color
);
assertTrue
(
nPoints
==
C
ore
.
countNonZero
(
gray0
));
}
public
void
testLineMatPointPointScalarInt
()
{
...
...
@@ -637,9 +637,9 @@ public class coreTest extends OpenCVTestCase {
Point
point2
=
new
Point
(
nPoints
,
nPoints
);
Scalar
color
=
new
Scalar
(
255
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
line
(
gray0
,
point1
,
point2
,
color
,
0
);
assertTrue
(
nPoints
==
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
line
(
gray0
,
point1
,
point2
,
color
,
0
);
assertTrue
(
nPoints
==
C
ore
.
countNonZero
(
gray0
));
}
public
void
testLineMatPointPointScalarIntInt
()
{
...
...
@@ -657,7 +657,7 @@ public class coreTest extends OpenCVTestCase {
in
.
put
(
0
,
0
,
1.0
,
10.0
,
100.0
,
1000.0
);
desired
.
put
(
0
,
0
,
0
,
2.3025851
,
4.6051702
,
6.9077554
);
c
ore
.
log
(
in
,
dst
);
C
ore
.
log
(
in
,
dst
);
assertMatEqual
(
desired
,
dst
);
}
...
...
@@ -665,18 +665,18 @@ public class coreTest extends OpenCVTestCase {
Mat
lut
=
new
Mat
(
1
,
256
,
CvType
.
CV_8UC1
);
lut
.
setTo
(
new
Scalar
(
0
));
c
ore
.
LUT
(
grayRnd
,
lut
,
dst
);
C
ore
.
LUT
(
grayRnd
,
lut
,
dst
);
assertMatEqual
(
gray0
,
dst
);
lut
.
setTo
(
new
Scalar
(
255
));
c
ore
.
LUT
(
grayRnd
,
lut
,
dst
);
C
ore
.
LUT
(
grayRnd
,
lut
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
testLUTMatMatMatInt
()
{
Mat
lut
=
new
Mat
(
1
,
256
,
CvType
.
CV_8UC1
);
lut
.
setTo
(
new
Scalar
(
255
));
c
ore
.
LUT
(
grayRnd
,
lut
,
dst
,
0
);
C
ore
.
LUT
(
grayRnd
,
lut
,
dst
,
0
);
assertMatEqual
(
gray255
,
dst
);
}
...
...
@@ -689,32 +689,32 @@ public class coreTest extends OpenCVTestCase {
y
.
put
(
0
,
0
,
4.0
,
12.0
,
40.0
,
8.0
);
out
.
put
(
0
,
0
,
5.0
,
13.0
,
41.0
,
10.0
);
c
ore
.
magnitude
(
x
,
y
,
dst
);
C
ore
.
magnitude
(
x
,
y
,
dst
);
assertMatEqual
(
out
,
dst
);
c
ore
.
magnitude
(
gray0_32f
,
gray255_32f
,
dst
);
C
ore
.
magnitude
(
gray0_32f
,
gray255_32f
,
dst
);
assertMatEqual
(
gray255_32f
,
dst
);
}
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
c
ore
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
C
ore
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
/*TODO: CV_COVAR_NORMAL*/
,
CvType
.
CV_32F
);
covar
.
inv
();
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
Mat
line2
=
grayRnd_32f
.
submat
(
1
,
2
,
0
,
grayRnd_32f
.
cols
());
double
d
=
0.0
;
d
=
c
ore
.
Mahalanobis
(
line1
,
line1
,
covar
);
d
=
C
ore
.
Mahalanobis
(
line1
,
line1
,
covar
);
assertEquals
(
0.0
,
d
);
d
=
c
ore
.
Mahalanobis
(
line1
,
line2
,
covar
);
d
=
C
ore
.
Mahalanobis
(
line1
,
line2
,
covar
);
assertTrue
(
d
>
0.0
);
}
public
void
testMax
()
{
c
ore
.
min
(
gray0
,
gray255
,
dst
);
C
ore
.
min
(
gray0
,
gray255
,
dst
);
assertMatEqual
(
gray0
,
dst
);
Mat
x
=
new
Mat
(
1
,
1
,
CvType
.
CV_32F
);
...
...
@@ -723,14 +723,14 @@ public class coreTest extends OpenCVTestCase {
x
.
put
(
0
,
0
,
23.0
);
y
.
put
(
0
,
0
,
4.0
);
dst
.
put
(
0
,
0
,
23.0
);
c
ore
.
max
(
x
,
y
,
dst
);
C
ore
.
max
(
x
,
y
,
dst
);
assertMatEqual
(
dst
,
dst
);
}
public
void
testMeanMat
()
{
Scalar
mean
=
null
;
mean
=
c
ore
.
mean
(
gray128
);
mean
=
C
ore
.
mean
(
gray128
);
assertEquals
(
new
Scalar
(
128
),
mean
);
}
...
...
@@ -742,18 +742,18 @@ public class coreTest extends OpenCVTestCase {
Mat
mean
=
new
Mat
();
Mat
stddev
=
new
Mat
();
c
ore
.
meanStdDev
(
rgba0
,
mean
,
stddev
);
assertEquals
(
0
,
c
ore
.
countNonZero
(
mean
));
assertEquals
(
0
,
c
ore
.
countNonZero
(
stddev
));
C
ore
.
meanStdDev
(
rgba0
,
mean
,
stddev
);
assertEquals
(
0
,
C
ore
.
countNonZero
(
mean
));
assertEquals
(
0
,
C
ore
.
countNonZero
(
stddev
));
}
public
void
testMeanStdDevMatMatMatMat
()
{
Mat
mean
=
new
Mat
();
Mat
stddev
=
new
Mat
();
c
ore
.
meanStdDev
(
rgba0
,
mean
,
stddev
,
gray255
);
assertEquals
(
0
,
c
ore
.
countNonZero
(
mean
));
assertEquals
(
0
,
c
ore
.
countNonZero
(
stddev
));
C
ore
.
meanStdDev
(
rgba0
,
mean
,
stddev
,
gray255
);
assertEquals
(
0
,
C
ore
.
countNonZero
(
mean
));
assertEquals
(
0
,
C
ore
.
countNonZero
(
stddev
));
Mat
submat
=
grayRnd
.
submat
(
0
,
grayRnd
.
rows
()/
2
,
0
,
grayRnd
.
cols
()/
2
);
submat
.
setTo
(
new
Scalar
(
33
));
...
...
@@ -762,14 +762,14 @@ public class coreTest extends OpenCVTestCase {
submat
=
mask
.
submat
(
0
,
mask
.
rows
()/
2
,
0
,
mask
.
cols
()/
2
);
submat
.
setTo
(
new
Scalar
(
1
));
c
ore
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
mask
);
C
ore
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
mask
);
Mat
desiredMean
=
new
Mat
(
1
,
1
,
CvType
.
CV_64F
,
new
Scalar
(
33
));
assertMatEqual
(
desiredMean
,
mean
);
assertEquals
(
0
,
c
ore
.
countNonZero
(
stddev
));
assertEquals
(
0
,
C
ore
.
countNonZero
(
stddev
));
c
ore
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
gray1
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
mean
));
assertTrue
(
0
!=
c
ore
.
countNonZero
(
stddev
));
C
ore
.
meanStdDev
(
grayRnd
,
mean
,
stddev
,
gray1
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
mean
));
assertTrue
(
0
!=
C
ore
.
countNonZero
(
stddev
));
}
public
void
testMerge
()
{
...
...
@@ -777,7 +777,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testMin
()
{
c
ore
.
min
(
gray0
,
gray255
,
dst
);
C
ore
.
min
(
gray0
,
gray255
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
...
...
@@ -789,7 +789,7 @@ public class coreTest extends OpenCVTestCase {
gray3
.
put
((
int
)
minLoc
.
y
,
(
int
)
minLoc
.
x
,
minVal
);
gray3
.
put
((
int
)
maxLoc
.
y
,
(
int
)
maxLoc
.
x
,
maxVal
);
core
.
MinMaxLocResult
mmres
=
c
ore
.
minMaxLoc
(
gray3
);
Core
.
MinMaxLocResult
mmres
=
C
ore
.
minMaxLoc
(
gray3
);
assertTrue
(
mmres
.
minVal
==
minVal
);
assertTrue
(
mmres
.
maxVal
==
maxVal
);
...
...
@@ -812,7 +812,7 @@ public class coreTest extends OpenCVTestCase {
src1
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
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
,
c
ore
.
DFT_ROWS
);
Core
.
mulSpectrums
(
src1
,
src2
,
dst
,
C
ore
.
DFT_ROWS
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -823,45 +823,45 @@ public class coreTest extends OpenCVTestCase {
src1
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
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
,
c
ore
.
DFT_ROWS
,
true
);
Core
.
mulSpectrums
(
src1
,
src2
,
dst
,
C
ore
.
DFT_ROWS
,
true
);
assertMatEqual
(
out
,
dst
);
}
public
void
testMultiplyMatMatMat
()
{
c
ore
.
multiply
(
gray0
,
gray255
,
dst
);
C
ore
.
multiply
(
gray0
,
gray255
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testMultiplyMatMatMatDouble
()
{
c
ore
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
);
C
ore
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testMultiplyMatMatMatDoubleInt
()
{
c
ore
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
,
-
1
);
C
ore
.
multiply
(
gray1
,
gray0
,
dst
,
2.0
,
-
1
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testMulTransposedMatMatBoolean
()
{
c
ore
.
mulTransposed
(
grayE_32f
,
dst
,
true
);
C
ore
.
mulTransposed
(
grayE_32f
,
dst
,
true
);
assertMatEqual
(
grayE_32f
,
dst
);
}
public
void
testMulTransposedMatMatBooleanMat
()
{
c
ore
.
mulTransposed
(
grayRnd_32f
,
dst
,
true
,
grayRnd_32f
);
C
ore
.
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
));
c
ore
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
);
C
ore
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
);
assertMatEqual
(
grayE_32f
,
dst
);
}
public
void
testMulTransposedMatMatBooleanMatDouble
()
{
Mat
grayDelta
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
grayDelta
.
setTo
(
new
Scalar
(
0.0
));
c
ore
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
,
1
);
C
ore
.
mulTransposed
(
grayE_32f
,
dst
,
true
,
grayDelta
,
1
);
assertMatEqual
(
grayE_32f
,
dst
);
}
...
...
@@ -877,22 +877,22 @@ public class coreTest extends OpenCVTestCase {
res
.
put
(
1
,
0
,
3
,
3
,
3
);
res
.
put
(
2
,
0
,
3
,
3
,
3
);
c
ore
.
mulTransposed
(
a
,
dst
,
true
,
grayDelta
,
1.0
,
1
);
C
ore
.
mulTransposed
(
a
,
dst
,
true
,
grayDelta
,
1.0
,
1
);
assertMatEqual
(
res
,
dst
);
}
public
void
testNormalizeMatMat
()
{
c
ore
.
normalize
(
gray0
,
dst
);
C
ore
.
normalize
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testNormalizeMatMatDouble
()
{
c
ore
.
normalize
(
gray0
,
dst
,
0.0
);
C
ore
.
normalize
(
gray0
,
dst
,
0.0
);
assertMatEqual
(
gray0
,
dst
);
}
public
void
testNormalizeMatMatDoubleDouble
()
{
c
ore
.
normalize
(
gray0
,
dst
,
0.0
,
1.0
);
C
ore
.
normalize
(
gray0
,
dst
,
0.0
,
1.0
);
assertMatEqual
(
gray0
,
dst
);
}
...
...
@@ -901,7 +901,7 @@ public class coreTest extends OpenCVTestCase {
Mat
out
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
c
ore
.
NORM_INF
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
C
ore
.
NORM_INF
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -912,7 +912,7 @@ public class coreTest extends OpenCVTestCase {
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
c
ore
.
NORM_INF
,
-
1
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
C
ore
.
NORM_INF
,
-
1
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -924,37 +924,37 @@ public class coreTest extends OpenCVTestCase {
src
.
put
(
0
,
0
,
1.0
,
2.0
,
3.0
,
4.0
);
out
.
put
(
0
,
0
,
0.25
,
0.5
,
0.75
,
1
);
core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
c
ore
.
NORM_INF
,
-
1
,
mask
);
Core
.
normalize
(
src
,
dst
,
1.0
,
2.0
,
C
ore
.
NORM_INF
,
-
1
,
mask
);
assertMatEqual
(
out
,
dst
);
}
public
void
testNormMat
()
{
double
n
=
c
ore
.
norm
(
gray0
);
double
n
=
C
ore
.
norm
(
gray0
);
assertTrue
(
0.0
==
n
);
}
public
void
testNormMatInt
()
{
double
n
=
core
.
norm
(
gray127
,
c
ore
.
NORM_INF
);
double
n
=
Core
.
norm
(
gray127
,
C
ore
.
NORM_INF
);
assertTrue
(
127
==
n
);
}
public
void
testNormMatIntMat
()
{
double
n
=
core
.
norm
(
gray3
,
c
ore
.
NORM_L1
,
gray0
);
double
n
=
Core
.
norm
(
gray3
,
C
ore
.
NORM_L1
,
gray0
);
assertEquals
(
0.0
,
n
);
}
public
void
testNormMatMat
()
{
double
n
=
c
ore
.
norm
(
gray255
,
gray255
);
double
n
=
C
ore
.
norm
(
gray255
,
gray255
);
assertEquals
(
0.0
,
n
);
}
public
void
testNormMatMatInt
()
{
double
n
=
core
.
norm
(
gray127
,
gray0
,
c
ore
.
NORM_INF
);
double
n
=
Core
.
norm
(
gray127
,
gray0
,
C
ore
.
NORM_INF
);
assertEquals
(
127.0
,
n
);
}
public
void
testNormMatMatIntMat
()
{
double
n
=
core
.
norm
(
gray3
,
gray0
,
c
ore
.
NORM_L1
,
gray0
);
double
n
=
Core
.
norm
(
gray3
,
gray0
,
C
ore
.
NORM_L1
,
gray0
);
assertEquals
(
0.0
,
n
);
}
...
...
@@ -972,7 +972,7 @@ public class coreTest extends OpenCVTestCase {
y
.
put
(
0
,
0
,
20.0
,
15.0
,
20.0
,
20.0
);
res
.
put
(
0
,
0
,
1.1071469
,
0.98280007
,
0.78539175
,
1.3258134
);
c
ore
.
phase
(
x
,
y
,
dst
);
C
ore
.
phase
(
x
,
y
,
dst
);
assertMatEqual
(
res
,
dst
);
}
...
...
@@ -985,7 +985,7 @@ public class coreTest extends OpenCVTestCase {
y
.
put
(
0
,
0
,
20.0
,
15.0
,
20.0
,
20.0
);
res
.
put
(
0
,
0
,
63.434
,
56.310
,
44.999
,
75.963
);
c
ore
.
phase
(
x
,
y
,
dst
,
true
);
C
ore
.
phase
(
x
,
y
,
dst
,
true
);
}
public
void
testPolarToCartMatMatMatMat
()
{
...
...
@@ -1008,7 +1008,7 @@ public class coreTest extends OpenCVTestCase {
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
//TODO: needs epsilon comparison
c
ore
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
C
ore
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
assertMatEqual
(
x
,
xCoordinate
);
}
...
...
@@ -1017,7 +1017,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testPow
()
{
c
ore
.
pow
(
gray3
,
2.0
,
dst
);
C
ore
.
pow
(
gray3
,
2.0
,
dst
);
assertMatEqual
(
gray9
,
dst
);
}
...
...
@@ -1041,18 +1041,18 @@ public class coreTest extends OpenCVTestCase {
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
randn
(
gray0
,
low
,
high
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
randn
(
gray0
,
low
,
high
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testRandu
()
{
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
randu
(
gray0
,
low
,
high
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
randu
(
gray0
,
low
,
high
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testRectangleMatPointPointScalar
()
{
...
...
@@ -1060,9 +1060,9 @@ public class coreTest extends OpenCVTestCase {
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testRectangleMatPointPointScalarInt
()
{
...
...
@@ -1070,9 +1070,9 @@ public class coreTest extends OpenCVTestCase {
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testRectangleMatPointPointScalarIntInt
()
{
...
...
@@ -1080,9 +1080,9 @@ public class coreTest extends OpenCVTestCase {
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
8
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
8
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testRectangleMatPointPointScalarIntIntInt
()
{
...
...
@@ -1090,9 +1090,9 @@ public class coreTest extends OpenCVTestCase {
Point
origin
=
new
Point
(
0
,
0
);
Scalar
color
=
new
Scalar
(
128
);
assertTrue
(
0
==
c
ore
.
countNonZero
(
gray0
));
c
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
4
,
2
);
assertTrue
(
0
!=
c
ore
.
countNonZero
(
gray0
));
assertTrue
(
0
==
C
ore
.
countNonZero
(
gray0
));
C
ore
.
rectangle
(
gray0
,
center
,
origin
,
color
,
2
,
4
,
2
);
assertTrue
(
0
!=
C
ore
.
countNonZero
(
gray0
));
}
public
void
testReduceMatMatIntInt
()
{
...
...
@@ -1103,7 +1103,7 @@ public class coreTest extends OpenCVTestCase {
out
.
put
(
0
,
0
,
1
,
0
);
c
ore
.
reduce
(
src
,
dst
,
0
,
2
);
C
ore
.
reduce
(
src
,
dst
,
0
,
2
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -1115,7 +1115,7 @@ public class coreTest extends OpenCVTestCase {
out
.
put
(
0
,
0
,
1
,
0
);
c
ore
.
reduce
(
src
,
dst
,
0
,
2
,
-
1
);
C
ore
.
reduce
(
src
,
dst
,
0
,
2
,
-
1
);
assertMatEqual
(
out
,
dst
);
}
...
...
@@ -1128,25 +1128,25 @@ public class coreTest extends OpenCVTestCase {
des1
.
put
(
0
,
0
,
1
,
2
,
3
);
des2
.
put
(
0
,
0
,
1
,
2
,
3
,
1
,
2
,
3
);
c
ore
.
repeat
(
src
,
1
,
1
,
dst
);
C
ore
.
repeat
(
src
,
1
,
1
,
dst
);
assertMatEqual
(
des1
,
dst
);
c
ore
.
repeat
(
src
,
1
,
2
,
dst
);
C
ore
.
repeat
(
src
,
1
,
2
,
dst
);
assertMatEqual
(
des2
,
dst
);
}
public
void
testScaleAdd
()
{
c
ore
.
scaleAdd
(
gray3
,
2.0
,
gray3
,
dst
);
C
ore
.
scaleAdd
(
gray3
,
2.0
,
gray3
,
dst
);
assertMatEqual
(
dst
,
gray9
);
}
public
void
testSetIdentityMat
()
{
c
ore
.
setIdentity
(
gray0_32f
);
C
ore
.
setIdentity
(
gray0_32f
);
assertMatEqual
(
grayE_32f
,
gray0_32f
);
}
public
void
testSetIdentityMatScalar
()
{
c
ore
.
gemm
(
grayE_32f
,
grayE_32f
,
5.0
,
new
Mat
(),
0.0
,
dst
);
c
ore
.
setIdentity
(
gray0_32f
,
new
Scalar
(
5
));
C
ore
.
gemm
(
grayE_32f
,
grayE_32f
,
5.0
,
new
Mat
(),
0.0
,
dst
);
C
ore
.
setIdentity
(
gray0_32f
,
new
Scalar
(
5
));
assertMatEqual
(
dst
,
gray0_32f
);
}
...
...
@@ -1155,7 +1155,7 @@ public class coreTest extends OpenCVTestCase {
Mat
roots
=
new
Mat
(
3
,
1
,
CvType
.
CV_32F
);
coeffs
.
put
(
0
,
0
,
1
,
6
,
11
,
6
);
roots
.
put
(
0
,
0
,
-
3
,
-
1
,
-
2
);
c
ore
.
solveCubic
(
coeffs
,
dst
);
C
ore
.
solveCubic
(
coeffs
,
dst
);
assertMatEqual
(
roots
,
dst
);
}
...
...
@@ -1170,7 +1170,7 @@ public class coreTest extends OpenCVTestCase {
b
.
put
(
0
,
0
,
0
,
4
,
2
);
res
.
put
(
0
,
0
,
-
12
,
2
,
10
);
c
ore
.
solve
(
a
,
b
,
dst
);
C
ore
.
solve
(
a
,
b
,
dst
);
assertMatEqual
(
res
,
dst
);
}
...
...
@@ -1186,7 +1186,7 @@ public class coreTest extends OpenCVTestCase {
b
.
put
(
0
,
0
,
0
,
4
,
2
);
res
.
put
(
0
,
0
,
-
12
,
2
,
10
);
c
ore
.
solve
(
a
,
b
,
dst
,
3
);
C
ore
.
solve
(
a
,
b
,
dst
,
3
);
assertMatEqual
(
res
,
dst
);
}
...
...
@@ -1199,7 +1199,7 @@ public class coreTest extends OpenCVTestCase {
Mat
answer
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
answer
.
put
(
0
,
0
,
1
,
0
,
2
,
0
,
3
,
0
);
c
ore
.
solvePoly
(
coeffs
,
roots
);
C
ore
.
solvePoly
(
coeffs
,
roots
);
assertMatEqual
(
answer
,
roots
);
}
...
...
@@ -1212,7 +1212,7 @@ public class coreTest extends OpenCVTestCase {
Mat
answer
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
answer
.
put
(
0
,
0
,
1
,
0
,
-
1
,
2
,
-
2
,
12
);
c
ore
.
solvePoly
(
coeffs
,
roots
,
1
);
C
ore
.
solvePoly
(
coeffs
,
roots
,
1
);
assertMatEqual
(
answer
,
roots
);
}
...
...
@@ -1220,13 +1220,13 @@ public class coreTest extends OpenCVTestCase {
Mat
submat
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1.0
));
c
ore
.
sort
(
gray0
,
dst
,
0
/*TODO: CV_SORT_EVERY_ROW*/
);
C
ore
.
sort
(
gray0
,
dst
,
0
/*TODO: CV_SORT_EVERY_ROW*/
);
submat
=
dst
.
submat
(
0
,
dst
.
rows
()
/
2
,
dst
.
cols
()
/
2
,
dst
.
cols
());
assertTrue
(
submat
.
total
()
==
c
ore
.
countNonZero
(
submat
));
assertTrue
(
submat
.
total
()
==
C
ore
.
countNonZero
(
submat
));
c
ore
.
sort
(
gray0
,
dst
,
1
/*TODO: CV_SORT_EVERY_COLUMN*/
);
C
ore
.
sort
(
gray0
,
dst
,
1
/*TODO: CV_SORT_EVERY_COLUMN*/
);
submat
=
dst
.
submat
(
dst
.
rows
()
/
2
,
dst
.
rows
(),
0
,
dst
.
cols
()
/
2
);
assertTrue
(
submat
.
total
()
==
c
ore
.
countNonZero
(
submat
));
assertTrue
(
submat
.
total
()
==
C
ore
.
countNonZero
(
submat
));
}
public
void
testSortIdx
()
{
...
...
@@ -1238,20 +1238,20 @@ public class coreTest extends OpenCVTestCase {
answer
.
put
(
1
,
0
,
0
,
2
,
1
);
answer
.
put
(
2
,
0
,
0
,
1
,
2
);
c
ore
.
sortIdx
(
a
,
b
,
0
+
0
/*TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING*/
);
C
ore
.
sortIdx
(
a
,
b
,
0
+
0
/*TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING*/
);
assertMatEqual
(
answer
,
b
);
}
public
void
testSplit
()
{
ArrayList
<
Mat
>
cois
=
new
ArrayList
<
Mat
>();
c
ore
.
split
(
rgba0
,
cois
);
C
ore
.
split
(
rgba0
,
cois
);
for
(
Mat
coi
:
cois
)
{
assertMatEqual
(
gray0
,
coi
);
}
}
public
void
testSqrt
()
{
c
ore
.
sqrt
(
gray9_32f
,
dst
);
C
ore
.
sqrt
(
gray9_32f
,
dst
);
assertMatEqual
(
gray3_32f
,
dst
);
Mat
rgba144
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32FC4
);
...
...
@@ -1259,12 +1259,12 @@ public class coreTest extends OpenCVTestCase {
rgba144
.
setTo
(
Scalar
.
all
(
144
));
rgba12
.
setTo
(
Scalar
.
all
(
12
));
c
ore
.
sqrt
(
rgba144
,
dst
);
C
ore
.
sqrt
(
rgba144
,
dst
);
assertMatEqual
(
rgba12
,
dst
);
}
public
void
testSubtractMatMatMat
()
{
c
ore
.
subtract
(
gray128
,
gray1
,
dst
);
C
ore
.
subtract
(
gray128
,
gray1
,
dst
);
assertMatEqual
(
gray127
,
dst
);
}
...
...
@@ -1274,12 +1274,12 @@ public class coreTest extends OpenCVTestCase {
submask
.
setTo
(
new
Scalar
(
1
));
dst
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
0
));
c
ore
.
subtract
(
gray3
,
gray2
,
dst
,
mask
);
assertTrue
(
submask
.
total
()
==
c
ore
.
countNonZero
(
dst
));
C
ore
.
subtract
(
gray3
,
gray2
,
dst
,
mask
);
assertTrue
(
submask
.
total
()
==
C
ore
.
countNonZero
(
dst
));
}
public
void
testSubtractMatMatMatMatInt
()
{
c
ore
.
subtract
(
gray3
,
gray2
,
dst
,
gray1
,
CvType
.
CV_32F
);
C
ore
.
subtract
(
gray3
,
gray2
,
dst
,
gray1
,
CvType
.
CV_32F
);
assertTrue
(
CvType
.
CV_32F
==
dst
.
depth
());
assertMatEqual
(
gray1_32f
,
dst
);
}
...
...
@@ -1296,7 +1296,7 @@ public class coreTest extends OpenCVTestCase {
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
,
new
Scalar
(
55
));
Mat
m
=
Mat
.
eye
(
2
,
2
,
CvType
.
CV_32FC1
);
c
ore
.
transform
(
src
,
dst
,
m
);
C
ore
.
transform
(
src
,
dst
,
m
);
Mat
answer
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC2
,
new
Scalar
(
55
,
1
));
assertMatEqual
(
answer
,
dst
);
}
...
...
@@ -1306,8 +1306,8 @@ public class coreTest extends OpenCVTestCase {
Mat
destination
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
destination
.
setTo
(
new
Scalar
(
0
));
Mat
subdst
=
destination
.
submat
(
0
,
destination
.
rows
(),
0
,
destination
.
cols
()
/
2
);
subgray0
.
setTo
(
new
Scalar
(
1
));
c
ore
.
transpose
(
gray0
,
destination
);
assertTrue
(
subdst
.
total
()
==
c
ore
.
countNonZero
(
subdst
));
C
ore
.
transpose
(
gray0
,
destination
);
assertTrue
(
subdst
.
total
()
==
C
ore
.
countNonZero
(
subdst
));
}
}
modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java
View file @
6b789dd2
package
org
.
opencv
.
test
.
highgui
;
import
org.opencv.highgui
;
import
org.opencv.VideoCapture
;
import
org.opencv.highgui
.Highgui
;
import
org.opencv.
highgui.
VideoCapture
;
import
org.opencv.test.OpenCVTestCase
;
...
...
@@ -26,8 +26,8 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testGet
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
double
frameWidth
=
capture
.
get
(
h
ighgui
.
CV_CAP_PROP_FRAME_WIDTH
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
double
frameWidth
=
capture
.
get
(
H
ighgui
.
CV_CAP_PROP_FRAME_WIDTH
);
capture
.
release
();
assertTrue
(
0
!=
frameWidth
);
}
...
...
@@ -39,7 +39,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testGrabFromRealCamera
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
isSucceed
=
capture
.
grab
();
capture
.
release
();
assertTrue
(
isSucceed
);
...
...
@@ -51,7 +51,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testIsOpenedRealCamera
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
isOpened
=
capture
.
isOpened
();
capture
.
release
();
assertTrue
(
isOpened
);
...
...
@@ -59,7 +59,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public
void
testOpenInt
()
{
capture
=
new
VideoCapture
();
capture
.
open
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
.
open
(
H
ighgui
.
CV_CAP_ANDROID
);
isOpened
=
capture
.
isOpened
();
capture
.
release
();
assertTrue
(
isOpened
);
...
...
@@ -70,7 +70,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testRead
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
isSucceed
=
capture
.
read
(
dst
);
capture
.
release
();
assertTrue
(
isSucceed
);
...
...
@@ -79,13 +79,13 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testRelease
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
capture
.
release
();
assertFalse
(
capture
.
isOpened
());
}
public
void
testRetrieveMat
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
capture
.
grab
();
isSucceed
=
capture
.
retrieve
(
dst
);
capture
.
release
();
...
...
@@ -95,7 +95,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testRetrieveMatInt
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
capture
.
grab
();
isSucceed
=
capture
.
retrieve
(
dst
,
1
);
capture
.
release
();
...
...
@@ -106,9 +106,9 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testSet
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
.
set
(
h
ighgui
.
CV_CAP_PROP_FRAME_WIDTH
,
640.0
);
double
frameWidth
=
capture
.
get
(
h
ighgui
.
CV_CAP_PROP_FRAME_WIDTH
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
capture
.
set
(
H
ighgui
.
CV_CAP_PROP_FRAME_WIDTH
,
640.0
);
double
frameWidth
=
capture
.
get
(
H
ighgui
.
CV_CAP_PROP_FRAME_WIDTH
);
capture
.
read
(
dst
);
capture
.
release
();
assertEquals
(
640.0
,
frameWidth
);
...
...
@@ -121,7 +121,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public
void
testVideoCaptureInt
()
{
capture
=
new
VideoCapture
(
h
ighgui
.
CV_CAP_ANDROID
);
capture
=
new
VideoCapture
(
H
ighgui
.
CV_CAP_ANDROID
);
assertTrue
(
null
!=
capture
);
isOpened
=
capture
.
isOpened
();
capture
.
release
();
...
...
modules/java/android_test/src/org/opencv/test/highgui/highguiTest.java
View file @
6b789dd2
package
org
.
opencv
.
test
.
highgui
;
import
org.opencv.highgui
;
import
org.opencv.highgui
.Highgui
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
@@ -8,7 +8,7 @@ import org.opencv.test.OpenCVTestRunner;
public
class
highguiTest
extends
OpenCVTestCase
{
public
void
testImreadString
()
{
dst
=
h
ighgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
dst
=
H
ighgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
);
assertTrue
(!
dst
.
empty
());
assertEquals
(
3
,
dst
.
channels
());
assertTrue
(
512
==
dst
.
cols
());
...
...
@@ -16,7 +16,7 @@ public class highguiTest extends OpenCVTestCase {
}
public
void
testImreadStringInt
()
{
dst
=
h
ighgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
,
0
);
dst
=
H
ighgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
,
0
);
assertTrue
(!
dst
.
empty
());
assertEquals
(
1
,
dst
.
channels
());
assertTrue
(
512
==
dst
.
cols
());
...
...
modules/java/android_test/src/org/opencv/test/imgproc/imgprocTest.java
View file @
6b789dd2
...
...
@@ -3,12 +3,12 @@ package org.opencv.test.imgproc;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Scalar
;
import
org.opencv.Size
;
import
org.opencv.core
;
import
org.opencv.imgproc
;
import
org.opencv.
core.
CvType
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Scalar
;
import
org.opencv.
core.
Size
;
import
org.opencv.core
.Core
;
import
org.opencv.imgproc
.Imgproc
;
import
org.opencv.test.OpenCVTestCase
;
...
...
@@ -21,7 +21,7 @@ public class imgprocTest extends OpenCVTestCase {
//FIXME: this test crashes
//public void test_Can_Call_accumulate() {
// dst = new Mat(gray1.rows(), gray1.cols(), Mat.CvType.CV_32FC1);
//
i
mgproc.accumulate(gray1, dst);
//
I
mgproc.accumulate(gray1, dst);
// assertMatEqual(gray1, dst);
//}
...
...
@@ -80,10 +80,10 @@ public class imgprocTest extends OpenCVTestCase {
public
void
testBlurMatMatSize
()
{
Size
sz
=
new
Size
(
3
,
3
);
i
mgproc
.
blur
(
gray0
,
dst
,
sz
);
I
mgproc
.
blur
(
gray0
,
dst
,
sz
);
assertMatEqual
(
gray0
,
dst
);
i
mgproc
.
blur
(
gray255
,
dst
,
sz
);
I
mgproc
.
blur
(
gray255
,
dst
,
sz
);
assertMatEqual
(
gray255
,
dst
);
}
...
...
@@ -105,7 +105,7 @@ public class imgprocTest extends OpenCVTestCase {
public
void
testBoxFilterMatMatIntSize
()
{
Size
sz
=
new
Size
(
3
,
3
);
i
mgproc
.
boxFilter
(
gray0
,
dst
,
8
,
sz
);
I
mgproc
.
boxFilter
(
gray0
,
dst
,
8
,
sz
);
assertMatEqual
(
gray0
,
dst
);
}
...
...
@@ -133,13 +133,13 @@ public class imgprocTest extends OpenCVTestCase {
ranges
.
add
(
0.0f
);
ranges
.
add
(
256.0f
);
Mat
hist
=
new
Mat
();
i
mgproc
.
calcHist
(
images
,
channels
,
new
Mat
(),
hist
,
histSize
,
ranges
);
c
ore
.
normalize
(
hist
,
hist
);
I
mgproc
.
calcHist
(
images
,
channels
,
new
Mat
(),
hist
,
histSize
,
ranges
);
C
ore
.
normalize
(
hist
,
hist
);
i
mgproc
.
calcBackProject
(
images
,
channels
,
hist
,
dst
,
ranges
,
255
);
I
mgproc
.
calcBackProject
(
images
,
channels
,
hist
,
dst
,
ranges
,
255
);
assertTrue
(
grayChess
.
size
().
equals
(
dst
.
size
()));
assertEquals
(
grayChess
.
depth
(),
dst
.
depth
());
assertTrue
(
0
!=
c
ore
.
countNonZero
(
dst
));
assertTrue
(
0
!=
C
ore
.
countNonZero
(
dst
));
}
public
void
testCalcHistListOfMatListOfIntegerMatMatListOfIntegerListOfFloat
()
{
...
...
@@ -157,7 +157,7 @@ public class imgprocTest extends OpenCVTestCase {
truth
.
put
(
5
,
0
,
100.0
);
Mat
hist
=
new
Mat
();
i
mgproc
.
calcHist
(
images
,
channels
,
new
Mat
(),
hist
,
histSize
,
ranges
);
I
mgproc
.
calcHist
(
images
,
channels
,
new
Mat
(),
hist
,
histSize
,
ranges
);
assertMatEqual
(
truth
,
hist
);
}
...
...
@@ -183,7 +183,7 @@ public class imgprocTest extends OpenCVTestCase {
truth
.
put
(
9
,
5
,
100.0
);
Mat
hist
=
new
Mat
();
i
mgproc
.
calcHist
(
images
,
channels
,
new
Mat
(),
hist
,
histSize
,
ranges
);
I
mgproc
.
calcHist
(
images
,
channels
,
new
Mat
(),
hist
,
histSize
,
ranges
);
assertMatEqual
(
truth
,
hist
);
}
...
...
modules/java/android_test/src/org/opencv/test/objdetect/CascadeClassifierTest.java
View file @
6b789dd2
...
...
@@ -2,10 +2,10 @@ package org.opencv.test.objdetect;
import
java.util.ArrayList
;
import
org.opencv.Mat
;
import
org.opencv.Rect
;
import
org.opencv.Size
;
import
org.opencv.imgproc
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Rect
;
import
org.opencv.
core.
Size
;
import
org.opencv.imgproc
.Imgproc
;
import
org.opencv.objdetect.CascadeClassifier
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
...
...
@@ -36,7 +36,7 @@ public class CascadeClassifierTest extends OpenCVTestCase {
ArrayList
<
Rect
>
faces
=
new
ArrayList
<
Rect
>();
Mat
greyLena
=
new
Mat
();
imgproc
.
cvtColor
(
rgbLena
,
greyLena
,
i
mgproc
.
COLOR_RGB2GRAY
);
Imgproc
.
cvtColor
(
rgbLena
,
greyLena
,
I
mgproc
.
COLOR_RGB2GRAY
);
//TODO: doesn't detect with 1.1 scale
cc
.
detectMultiScale
(
greyLena
,
faces
,
1.09
,
2
,
2
/*TODO: CV_HAAR_SCALE_IMAGE*/
,
new
Size
(
30
,
30
));
...
...
modules/java/android_test/src/org/opencv/test/objdetect/objdetectTest.java
View file @
6b789dd2
...
...
@@ -2,8 +2,8 @@ package org.opencv.test.objdetect;
import
java.util.ArrayList
;
import
org.opencv.Rect
;
import
org.opencv.objdetect
;
import
org.opencv.
core.
Rect
;
import
org.opencv.objdetect
.Objdetect
;
import
org.opencv.test.OpenCVTestCase
;
...
...
@@ -17,7 +17,7 @@ public class objdetectTest extends OpenCVTestCase {
rects
.
add
(
r
);
int
groupThreshold
=
1
;
o
bjdetect
.
groupRectangles
(
rects
,
groupThreshold
);
O
bjdetect
.
groupRectangles
(
rects
,
groupThreshold
);
assertEquals
(
1
,
rects
.
size
());
}
...
...
@@ -33,7 +33,7 @@ public class objdetectTest extends OpenCVTestCase {
int
groupThreshold
=
1
;
double
eps
=
0.2
;
o
bjdetect
.
groupRectangles
(
rects
,
groupThreshold
,
eps
);
O
bjdetect
.
groupRectangles
(
rects
,
groupThreshold
,
eps
);
assertEquals
(
2
,
rects
.
size
());
}
...
...
modules/java/android_test/src/org/opencv/test/video/videoTest.java
View file @
6b789dd2
package
org
.
opencv
.
test
.
video
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Size
;
import
org.opencv.core
;
import
org.opencv.video
;
import
org.opencv.
core.
CvType
;
import
org.opencv.
core.
Mat
;
import
org.opencv.
core.
Size
;
import
org.opencv.core
.Core
;
import
org.opencv.video
.Video
;
import
org.opencv.test.OpenCVTestCase
;
...
...
@@ -59,8 +59,8 @@ public class videoTest extends OpenCVTestCase {
Mat
prevPts
=
new
Mat
(
1
,
3
,
CvType
.
CV_32FC2
);
prevPts
.
put
(
0
,
0
,
1.0
,
1.0
,
5.0
,
5.0
,
10.0
,
10.0
);
v
ideo
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
);
assertEquals
(
3
,
c
ore
.
countNonZero
(
status
));
V
ideo
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
);
assertEquals
(
3
,
C
ore
.
countNonZero
(
status
));
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSize
()
{
...
...
@@ -68,8 +68,8 @@ public class videoTest extends OpenCVTestCase {
prevPts
.
put
(
0
,
0
,
1.0
,
1.0
,
5.0
,
5.0
,
10.0
,
10.0
);
Size
sz
=
new
Size
(
5
,
5
);
v
ideo
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
,
sz
);
assertEquals
(
0
,
c
ore
.
countNonZero
(
status
));
V
ideo
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
,
sz
);
assertEquals
(
0
,
C
ore
.
countNonZero
(
status
));
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeInt
()
{
...
...
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