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