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
edead9a2
Commit
edead9a2
authored
Jul 30, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java tests: added some new asserts, and new tests by Hussein Abdinoor
parent
c11a7184
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
129 additions
and
82 deletions
+129
-82
ConvertersTest.java
...java/android_test/src/org/opencv/test/ConvertersTest.java
+3
-0
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+23
-2
coreTest.java
.../java/android_test/src/org/opencv/test/core/coreTest.java
+9
-26
StarDetectorTest.java
...test/src/org/opencv/test/features2d/StarDetectorTest.java
+3
-6
imgprocTest.java
...android_test/src/org/opencv/test/imgproc/imgprocTest.java
+91
-48
No files found.
modules/java/android_test/src/org/opencv/test/ConvertersTest.java
View file @
edead9a2
package
org
.
opencv
.
test
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ConvertersTest
extends
OpenCVTestCase
{
...
...
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
edead9a2
package
org
.
opencv
.
test
;
import
java.util.List
;
import
junit.framework.TestCase
;
import
org.opencv.core.CvType
;
...
...
@@ -14,10 +16,13 @@ public class OpenCVTestCase extends TestCase {
protected
static
int
matSize
=
10
;
protected
static
double
EPS
=
0.001
;
protected
static
double
weakEPS
=
0.5
;
protected
static
Mat
dst
;
protected
static
Mat
truth
;
protected
static
Scalar
colorBlack
;
// Naming notation: <channels info>_[depth]_[dimensions]_value
// examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
...
...
@@ -72,6 +77,8 @@ public class OpenCVTestCase extends TestCase {
truth
=
new
Mat
();
assertTrue
(
truth
.
empty
());
colorBlack
=
new
Scalar
(
0
);
gray0
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
0
));
gray1
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
1
));
gray2
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
2
));
...
...
@@ -82,8 +89,7 @@ public class OpenCVTestCase extends TestCase {
gray255
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
255
));
gray_16u_256
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16U
,
new
Scalar
(
256
));
gray_16s_1024
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16S
,
new
Scalar
(
1024
));
gray_16s_1024
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_16S
,
new
Scalar
(
1024
));
grayRnd
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
);
Core
.
randu
(
grayRnd
,
new
Scalar
(
0
),
new
Scalar
(
256
));
...
...
@@ -151,6 +157,16 @@ public class OpenCVTestCase extends TestCase {
super
.
tearDown
();
}
public
static
void
assertListEqual
(
List
<
Float
>
list1
,
List
<
Float
>
list2
,
double
epsilon
)
{
if
(
list1
.
size
()
!=
list2
.
size
())
{
throw
new
UnsupportedOperationException
();
}
for
(
int
i
=
0
;
i
<
list1
.
size
();
i
++)
assertTrue
(
Math
.
abs
(
list1
.
get
(
i
)
-
list2
.
get
(
i
))
<=
epsilon
);
}
public
static
void
assertMatEqual
(
Mat
m1
,
Mat
m2
)
{
compareMats
(
m1
,
m2
,
true
);
}
...
...
@@ -176,6 +192,11 @@ public class OpenCVTestCase extends TestCase {
assertEquals
(
expected
.
class_id
,
actual
.
class_id
);
}
public
static
void
assertPointEquals
(
Point
expected
,
Point
actual
,
double
eps
){
assertEquals
(
expected
.
x
,
actual
.
x
,
eps
);
assertEquals
(
expected
.
y
,
actual
.
y
,
eps
);
}
static
private
void
compareMats
(
Mat
expected
,
Mat
actual
,
boolean
isEqualityMeasured
)
{
if
(
expected
.
type
()
!=
actual
.
type
()
||
expected
.
cols
()
!=
actual
.
cols
()
||
expected
.
rows
()
!=
actual
.
rows
())
{
...
...
modules/java/android_test/src/org/opencv/test/core/coreTest.java
View file @
edead9a2
...
...
@@ -99,10 +99,8 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_64FC1
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
* CV_COVAR_NORMAL
*/
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
Core
.
COVAR_ROWS
|
Core
.
COVAR_NORMAL
);
assertMatEqual
(
gray0_64f
,
covar
,
EPS
);
assertMatEqual
(
gray0_64f_1d
,
mean
,
EPS
);
}
...
...
@@ -111,10 +109,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
* CV_COVAR_NORMAL
*/
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
Core
.
COVAR_ROWS
|
Core
.
COVAR_NORMAL
,
CvType
.
CV_32F
);
assertMatEqual
(
gray0_32f
,
covar
,
EPS
);
assertMatEqual
(
gray0_32f_1d
,
mean
,
EPS
);
}
...
...
@@ -744,11 +739,8 @@ public class coreTest extends OpenCVTestCase {
Core
.
invert
(
src
,
dst
);
assertMatEqual
(
truth
,
dst
,
EPS
);
// TODO: needs epsilon comparison
// Mat m = grayRnd_32f.clone();
// Mat inv = m.inv();
// Core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
// assertMatEqual(grayE_32f, dst);
Core
.
gemm
(
grayRnd_32f
,
grayRnd_32f
.
inv
(),
1.0
,
new
Mat
(),
0.0
,
dst
);
assertMatEqual
(
grayE_32f
,
dst
,
EPS
);
}
public
void
testInvertMatMatInt
()
{
...
...
@@ -852,10 +844,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32F
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
/*
* TODO:
* CV_COVAR_NORMAL
*/
,
CvType
.
CV_32F
);
Core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
Core
.
COVAR_ROWS
|
Core
.
COVAR_NORMAL
,
CvType
.
CV_32F
);
covar
.
inv
();
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
...
...
@@ -1222,18 +1211,12 @@ public class coreTest extends OpenCVTestCase {
Mat
xCoordinate
=
new
Mat
();
Mat
yCoordinate
=
new
Mat
();
// x.put(0, 0, 3.0, 6.0, 5,0);
// y.put(0, 0, 4.0, 8.0, 12.0);
// magnitude.put(0, 0, 5.0, 10.0, 13.0);
// angle.put(0, 0, 0.92729962, 0.92729962, 1.1759995);
magnitude
.
put
(
0
,
0
,
5.0
,
10.0
,
13.0
);
angle
.
put
(
0
,
0
,
0.92729962
,
0.92729962
,
1.1759995
);
x
.
put
(
0
,
0
,
3.0
,
6.0
,
5
,
0
);
y
.
put
(
0
,
0
,
4.0
,
8.0
,
12.0
);
// TODO: needs epsilon comparison
Core
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
assertMatEqual
(
x
,
xCoordinate
,
EPS
);
}
...
...
@@ -1504,11 +1487,11 @@ public class coreTest extends OpenCVTestCase {
Mat
submat
=
gray0
.
submat
(
0
,
gray0
.
rows
()
/
2
,
0
,
gray0
.
cols
()
/
2
);
submat
.
setTo
(
new
Scalar
(
1.0
));
Core
.
sort
(
gray0
,
dst
,
0
/* TODO: CV_SORT_EVERY_ROW */
);
Core
.
sort
(
gray0
,
dst
,
Core
.
SORT_EVERY_ROW
);
submat
=
dst
.
submat
(
0
,
dst
.
rows
()
/
2
,
dst
.
cols
()
/
2
,
dst
.
cols
());
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
Core
.
sort
(
gray0
,
dst
,
1
/* TODO: CV_SORT_EVERY_COLUMN */
);
Core
.
sort
(
gray0
,
dst
,
Core
.
SORT_EVERY_COLUMN
);
submat
=
dst
.
submat
(
dst
.
rows
()
/
2
,
dst
.
rows
(),
0
,
dst
.
cols
()
/
2
);
assertTrue
(
submat
.
total
()
==
Core
.
countNonZero
(
submat
));
}
...
...
@@ -1522,7 +1505,7 @@ public class coreTest extends OpenCVTestCase {
truth
.
put
(
1
,
0
,
0
,
2
,
1
);
truth
.
put
(
2
,
0
,
0
,
1
,
2
);
Core
.
sortIdx
(
a
,
b
,
0
+
0
/* TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING */
);
Core
.
sortIdx
(
a
,
b
,
Core
.
SORT_EVERY_ROW
+
Core
.
SORT_ASCENDING
);
assertMatEqual
(
truth
,
b
);
}
...
...
modules/java/android_test/src/org/opencv/test/features2d/StarDetectorTest.java
View file @
edead9a2
package
org
.
opencv
.
test
.
features2d
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.RotatedRect
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Size
;
import
org.opencv.features2d.KeyPoint
;
import
org.opencv.features2d.StarDetector
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.LinkedList
;
import
java.util.List
;
public
class
StarDetectorTest
extends
OpenCVTestCase
{
...
...
modules/java/android_test/src/org/opencv/test/imgproc/imgprocTest.java
View file @
edead9a2
...
...
@@ -3,6 +3,7 @@ package org.opencv.test.imgproc;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.Converters
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
...
...
@@ -11,8 +12,10 @@ import org.opencv.core.Rect;
import
org.opencv.core.RotatedRect
;
import
org.opencv.core.Scalar
;
import
org.opencv.core.Size
;
import
org.opencv.core.TermCriteria
;
import
org.opencv.imgproc.Imgproc
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
public
class
imgprocTest
extends
OpenCVTestCase
{
...
...
@@ -42,8 +45,8 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testAccumulateMatMat
()
{
truth
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_64F
,
new
Scalar
(
2
));
Imgproc
.
accumulate
(
gray_64f_2
,
dst64F
);
truth
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_64F
,
new
Scalar
(
2
));
assertMatEqual
(
truth
,
dst64F
,
EPS
);
dst
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_32FC1
,
new
Scalar
(
0
));
...
...
@@ -52,9 +55,8 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testAccumulateMatMatMat
()
{
Imgproc
.
accumulate
(
gray_64f_2
,
dst64F
,
mask
);
//TODO: use better mask
truth
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_64F
,
new
Scalar
(
2
));
Imgproc
.
accumulate
(
gray_64f_2
,
dst64F
,
mask
);
// TODO: use better mask
assertMatEqual
(
truth
,
dst64F
,
EPS
);
}
...
...
@@ -65,13 +67,11 @@ public class imgprocTest extends OpenCVTestCase {
src2
.
put
(
0
,
0
,
2
,
1
);
src2
.
put
(
1
,
0
,
1
,
2
);
Mat
dstImage
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_64F
,
new
Scalar
(
0
));
Imgproc
.
accumulateProduct
(
src1
,
src2
,
dstImage
);
truth
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_64F
,
new
Scalar
(
2
));
truth
.
put
(
0
,
0
,
2
,
1
);
truth
.
put
(
1
,
0
,
1
,
2
);
Mat
dstImage
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_64F
,
new
Scalar
(
0
));
Imgproc
.
accumulateProduct
(
src1
,
src2
,
dstImage
);
assertMatEqual
(
truth
,
dstImage
,
EPS
);
}
...
...
@@ -358,18 +358,35 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testConvertMapsMatMatMatMatInt
()
{
Mat
map1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
,
new
Scalar
(
1
));
Mat
map2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
,
new
Scalar
(
1
));
Mat
map1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
,
new
Scalar
(
1
.0
));
Mat
map2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC1
,
new
Scalar
(
2.0
));
Mat
dstmap1
=
new
Mat
(
1
,
4
,
CvType
.
CV_16SC2
);
Mat
dstmap2
=
new
Mat
(
1
,
4
,
CvType
.
CV_16UC1
);
// FIXME: dstmap1 - Documentation says Cvtype but requires integer
Imgproc
.
convertMaps
(
map1
,
map2
,
dstmap1
,
dstmap2
,
CvType
.
CV_32F
);
fail
(
"Not yet implemented"
);
Imgproc
.
convertMaps
(
map1
,
map2
,
dstmap1
,
dstmap2
,
CvType
.
CV_16SC2
);
Mat
truthMap1
=
new
Mat
(
1
,
4
,
CvType
.
CV_16SC2
);
truthMap1
.
put
(
0
,
0
,
1
,
2
,
1
,
2
,
1
,
2
,
1
,
2
);
assertMatEqual
(
truthMap1
,
dstmap1
);
Mat
truthMap2
=
new
Mat
(
1
,
4
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
assertMatEqual
(
truthMap2
,
dstmap2
);
}
public
void
testConvertMapsMatMatMatMatIntBoolean
()
{
fail
(
"Not yet implemented"
);
Mat
map1
=
new
Mat
(
1
,
3
,
CvType
.
CV_32FC1
,
new
Scalar
(
2.0
));
Mat
map2
=
new
Mat
(
1
,
3
,
CvType
.
CV_32FC1
,
new
Scalar
(
4.0
));
Mat
dstmap1
=
new
Mat
(
1
,
3
,
CvType
.
CV_16SC2
);
Mat
dstmap2
=
new
Mat
(
1
,
3
,
CvType
.
CV_16UC1
);
Imgproc
.
convertMaps
(
map1
,
map2
,
dstmap1
,
dstmap2
,
CvType
.
CV_16SC2
,
false
);
Mat
truthMap1
=
new
Mat
(
1
,
3
,
CvType
.
CV_16SC2
);
truthMap1
.
put
(
0
,
0
,
2
,
4
,
2
,
4
,
2
,
4
);
assertMatEqual
(
truthMap1
,
dstmap1
);
Mat
truthMap2
=
new
Mat
(
1
,
3
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
assertMatEqual
(
truthMap2
,
dstmap2
);
}
public
void
testConvexHullMatMat
()
{
...
...
@@ -518,13 +535,29 @@ public class imgprocTest extends OpenCVTestCase {
truth
.
put
(
1
,
0
,
0.92708343
,
0.92708343
,
0.92708343
);
truth
.
put
(
2
,
0
,
0.58680564
,
0.92708343
,
0.68055564
);
Imgproc
.
cornerMinEigenVal
(
src
,
dst
,
blockSize
,
ksize
,
Imgproc
.
BORDER_REFLECT
);
Imgproc
.
cornerMinEigenVal
(
src
,
dst
,
blockSize
,
ksize
,
Imgproc
.
BORDER_REFLECT
);
assertMatEqual
(
truth
,
dst
,
EPS
);
}
public
void
testCornerSubPix
()
{
fail
(
"Not yet implemented"
);
Mat
img
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
128
));
Point
truthPosition
=
new
Point
(
img
.
cols
()/
2
,
img
.
rows
()/
2
);
Rect
r
=
new
Rect
(
new
Point
(
0
,
0
),
truthPosition
);
Core
.
rectangle
(
img
,
r
.
tl
(),
r
.
br
(),
new
Scalar
(
0
),
-
1
/*TODO: CV_FILLED*/
);
List
<
Point
>
corners
=
new
ArrayList
<
Point
>();
corners
.
add
(
new
Point
(
truthPosition
.
x
+
1
,
truthPosition
.
y
+
1
));
Size
winSize
=
new
Size
(
2
,
2
);
Size
zeroZone
=
new
Size
(-
1
,
-
1
);
TermCriteria
criteria
=
new
TermCriteria
(
2
/*TODO: CV_TERMCRIT_EPS*/
,
0
,
0.01
);
Mat
cornersMat
=
Converters
.
vector_Point2f_to_Mat
(
corners
);
Imgproc
.
cornerSubPix
(
img
,
cornersMat
,
winSize
,
zeroZone
,
criteria
);
Converters
.
Mat_to_vector_Point
(
cornersMat
,
corners
);
assertPointEquals
(
truthPosition
,
corners
.
get
(
0
),
weakEPS
);
}
public
void
testCvtColorMatMatInt
()
{
...
...
@@ -759,8 +792,7 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testFitEllipse
()
{
Mat
points
=
new
Mat
(
1
,
5
,
CvType
.
CV_32FC2
);
// TODO: use the list of
// Points
Mat
points
=
new
Mat
(
1
,
5
,
CvType
.
CV_32FC2
);
//TODO: use the list of Points
points
.
put
(
0
,
0
,
0.0
,
0.0
,
-
1.0
,
1.0
,
1.0
,
1.0
,
1.0
,
-
1.0
,
-
1.0
,
-
1.0
);
RotatedRect
rrect
=
new
RotatedRect
();
...
...
@@ -1064,12 +1096,20 @@ public class imgprocTest extends OpenCVTestCase {
}
public
void
testHoughCirclesMatMatIntDoubleDouble
()
{
// double minDist = gray255.row(0)/4;
// Imgproc.HoughCircles(gray255, dst, Imgproc.CV_HOUGH_GRADIENT, 2.0,
// 0.5);
// TODO : How do we test this?
int
sz
=
512
;
Mat
img
=
new
Mat
(
sz
,
sz
,
CvType
.
CV_8U
,
new
Scalar
(
128
));
fail
(
"Not yet implemented"
);
Mat
circles
=
new
Mat
();
Imgproc
.
HoughCircles
(
img
,
circles
,
Imgproc
.
CV_HOUGH_GRADIENT
,
2.0
,
img
.
rows
()/
4
);
assertEquals
(
0
,
circles
.
cols
());
Point
center
=
new
Point
(
img
.
cols
()/
2
,
img
.
rows
()/
2
);
int
radius
=
Math
.
min
(
img
.
cols
()/
4
,
img
.
rows
()/
4
);
Core
.
circle
(
img
,
center
,
radius
,
colorBlack
,
3
);
Imgproc
.
HoughCircles
(
img
,
circles
,
Imgproc
.
CV_HOUGH_GRADIENT
,
2.0
,
img
.
rows
()/
4
);
assertEquals
(
1
,
circles
.
cols
());
}
public
void
testHoughCirclesMatMatIntDoubleDoubleDouble
()
{
...
...
@@ -1129,9 +1169,9 @@ public class imgprocTest extends OpenCVTestCase {
Mat
map1
=
new
Mat
();
Mat
map2
=
new
Mat
();
//
FIXME: dstmap1 - Documentation says Cvtype but requires integer
Imgproc
.
initUndistortRectifyMap
(
cameraMatrix
,
distCoeffs
,
R
,
newCameraMatrix
,
size
,
CvType
.
CV_32F
,
map1
,
map2
);
//
TODO: complete this test
Imgproc
.
initUndistortRectifyMap
(
cameraMatrix
,
distCoeffs
,
R
,
newCameraMatrix
,
size
,
CvType
.
CV_32F
,
map1
,
map2
);
fail
(
"Not yet implemented"
);
}
...
...
@@ -1320,12 +1360,10 @@ public class imgprocTest extends OpenCVTestCase {
public
void
testLaplacianMatMatIntIntDouble
()
{
Mat
src
=
Mat
.
eye
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_32F
);
Imgproc
.
Laplacian
(
src
,
dst
,
CvType
.
CV_32F
,
1
,
2.0
);
truth
=
new
Mat
(
imgprocSz
,
imgprocSz
,
CvType
.
CV_32F
);
truth
.
put
(
0
,
0
,
-
8
,
8
);
truth
.
put
(
1
,
0
,
8
,
-
8
);
Imgproc
.
Laplacian
(
src
,
dst
,
CvType
.
CV_32F
,
1
,
2.0
);
assertMatEqual
(
truth
,
dst
,
EPS
);
}
...
...
@@ -1355,13 +1393,11 @@ public class imgprocTest extends OpenCVTestCase {
Mat
contour2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC2
);
contour1
.
put
(
0
,
0
,
1.0
,
1.0
,
5.0
,
1.0
,
4.0
,
3.0
,
6.0
,
2.0
);
contour
1
.
put
(
0
,
0
,
1.0
,
1.0
,
6.0
,
1.0
,
4.0
,
1.0
,
2.0
,
5.0
);
contour
2
.
put
(
0
,
0
,
1.0
,
1.0
,
6.0
,
1.0
,
4.0
,
1.0
,
2.0
,
5.0
);
// TODO: returns random comparers
double
comparer
=
Imgproc
.
matchShapes
(
contour1
,
contour2
,
Imgproc
.
CV_CONTOURS_MATCH_I1
,
1.0
);
double
expComparer
=
2.98
;
assertEquals
(
expComparer
,
comparer
);
double
comparer
=
Imgproc
.
matchShapes
(
contour1
,
contour2
,
Imgproc
.
CV_CONTOURS_MATCH_I1
,
1.0
);
double
truthComparer
=
2.98
;
assertEquals
(
truthComparer
,
comparer
,
weakEPS
);
}
public
void
testMatchTemplate
()
{
...
...
@@ -1393,22 +1429,28 @@ public class imgprocTest extends OpenCVTestCase {
points
.
put
(
0
,
0
,
1.0
,
1.0
,
5.0
,
1.0
,
4.0
,
3.0
,
6.0
,
2.0
);
RotatedRect
rrect
=
Imgproc
.
minAreaRect
(
points
);
// TODO - how to test rotated rectangle
fail
(
"Not yet implemented"
);
assertEquals
(
new
Size
(
2
,
5
),
rrect
.
size
);
assertEquals
(-
90.0
,
rrect
.
angle
);
assertEquals
(
new
Point
(
3.5
,
2
),
rrect
.
center
);
}
public
void
testMinEnclosingCircle
()
{
Mat
points
=
new
Mat
(
1
,
4
,
CvType
.
CV_32FC2
);
Point
actualCenter
=
new
Point
();
Point
expCenter
=
new
Point
(
0
,
0
);
float
radius
=
0.0f
;
// float expectedRadius = 1.0f;
points
.
put
(
0
,
0
,
-
1.0
,
0.0
,
0.0
,
1.0
,
1.0
,
0.0
,
0.0
,
-
1.0
);
// TODO: Unexpected radius is returned i.e 0
OpenCVTestRunner
.
Log
(
points
.
toString
());
OpenCVTestRunner
.
Log
(
points
.
dump
());
Point
actualCenter
=
new
Point
();
float
radius
=
347.0f
;
//FIXME: Unexpected radius is returned i.e 0
Imgproc
.
minEnclosingCircle
(
points
,
actualCenter
,
radius
);
assertEquals
(
expCenter
,
actualCenter
);
// assertEquals(expectedRadius, radius);
fail
(
"Not yet implemented"
);
Point
truthCenter
=
new
Point
(
0
,
0
);
assertEquals
(
truthCenter
,
actualCenter
);
float
truthRadius
=
1.0f
;
OpenCVTestRunner
.
Log
(
""
+
radius
);
assertEquals
(
truthRadius
,
radius
,
weakEPS
);
}
public
void
testMomentsMat
()
{
...
...
@@ -1548,9 +1590,10 @@ public class imgprocTest extends OpenCVTestCase {
public
void
testPyrMeanShiftFilteringMatMatDoubleDouble
()
{
Mat
src
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8UC3
,
new
Scalar
(
0.0
));
Imgproc
.
pyrMeanShiftFiltering
(
src
,
dst
,
2.0
,
4.0
);
// TODO : size of destination matrix not understandable
fail
(
"Not yet implemented"
);
Imgproc
.
pyrMeanShiftFiltering
(
src
,
dst
,
10.0
,
50.0
);
truth
=
src
.
clone
();
assertMatEqual
(
truth
,
dst
);
}
public
void
testPyrMeanShiftFilteringMatMatDoubleDoubleInt
()
{
...
...
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