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
51922658
Commit
51922658
authored
Jul 18, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java tests: added test for OFLK, FD, other improvements
parent
16ba62dc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
373 additions
and
70 deletions
+373
-70
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+3
-1
OpenCVTestRunner.java
...va/android_test/src/org/opencv/test/OpenCVTestRunner.java
+3
-3
coreTest.java
.../java/android_test/src/org/opencv/test/core/coreTest.java
+122
-24
CascadeClassifierTest.java
.../src/org/opencv/test/objdetect/CascadeClassifierTest.java
+105
-0
objdetectTest.java
...oid_test/src/org/opencv/test/objdetect/objdetectTest.java
+33
-25
videoTest.java
...ava/android_test/src/org/opencv/test/video/videoTest.java
+79
-0
gen_java.py
modules/java/gen_java.py
+28
-17
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
51922658
...
@@ -19,7 +19,9 @@ public class OpenCVTestCase extends TestCase {
...
@@ -19,7 +19,9 @@ public class OpenCVTestCase extends TestCase {
//Naming notation: <channels info>_[depth]_[dimensions]_value
//Naming notation: <channels info>_[depth]_[dimensions]_value
//examples: gray0 - single channel 8U 2d Mat filled with 0
//examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d - refactor ;)
// gray0_32f_1d - TODO: refactor
//TODO: create some masks
protected
static
Mat
gray0
;
protected
static
Mat
gray0
;
protected
static
Mat
gray1
;
protected
static
Mat
gray1
;
...
...
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
View file @
51922658
...
@@ -19,12 +19,12 @@ import android.util.Log;
...
@@ -19,12 +19,12 @@ import android.util.Log;
public
class
OpenCVTestRunner
extends
InstrumentationTestRunner
{
public
class
OpenCVTestRunner
extends
InstrumentationTestRunner
{
public
static
String
LENA_PATH
=
"/data/data/org.opencv.test/files/lena.jpg"
;
public
static
String
LENA_PATH
=
"/data/data/org.opencv.test/files/lena.jpg"
;
public
static
String
CHESS_PATH
=
"/data/data/org.opencv.test/files/chessboard.jpg"
;
public
static
String
CHESS_PATH
=
"/data/data/org.opencv.test/files/chessboard.jpg"
;
public
static
String
LBPCASCADE_FRONTALFACE_PATH
=
"/mnt/sdcard/lbpcascade_frontalface.xml"
;
public
static
String
LBPCASCADE_FRONTALFACE_PATH
=
"/mnt/sdcard/lbpcascade_frontalface.xml"
;
private
static
String
TAG
=
"opencv_test_java"
;
private
AndroidTestRunner
androidTestRunner
;
private
AndroidTestRunner
androidTestRunner
;
private
static
String
TAG
=
"opencv_test_java"
;
static
public
void
Log
(
String
message
)
{
static
public
void
Log
(
String
message
)
{
Log
.
e
(
TAG
,
message
);
Log
.
e
(
TAG
,
message
);
...
...
modules/java/android_test/src/org/opencv/test/core/coreTest.java
View file @
51922658
package
org
.
opencv
.
test
.
core
;
package
org
.
opencv
.
test
.
core
;
import
java.util.ArrayList
;
import
org.opencv.CvType
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Mat
;
import
org.opencv.Point
;
import
org.opencv.Point
;
import
org.opencv.Rect
;
import
org.opencv.Scalar
;
import
org.opencv.Scalar
;
import
org.opencv.core
;
import
org.opencv.core
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
org.opencv.test.OpenCVTestRunner
;
...
@@ -141,7 +143,6 @@ public class coreTest extends OpenCVTestCase {
...
@@ -141,7 +143,6 @@ public class coreTest extends OpenCVTestCase {
core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
core
.
cartToPolar
(
x
,
y
,
dst
,
dst_angle
,
false
);
assertMatEqual
(
magnitude
,
dst
);
assertMatEqual
(
magnitude
,
dst
);
OpenCVTestRunner
.
Log
(
dst_angle
.
dump
());
assertMatEqual
(
angle
,
dst_angle
);
assertMatEqual
(
angle
,
dst_angle
);
}
}
...
@@ -173,6 +174,31 @@ public class coreTest extends OpenCVTestCase {
...
@@ -173,6 +174,31 @@ public class coreTest extends OpenCVTestCase {
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testClipLine
()
{
Rect
r
=
new
Rect
(
10
,
10
,
10
,
10
);
Point
pt1
=
new
Point
(
5.0
,
15.0
);
Point
pt2
=
new
Point
(
25.0
,
15.0
);
Point
pt1Clipped
=
new
Point
(
10.0
,
15.0
);
Point
pt2Clipped
=
new
Point
(
19.0
,
15.0
);
boolean
res
=
core
.
clipLine
(
r
,
pt1
,
pt2
);
assertEquals
(
true
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
assertEquals
(
pt2Clipped
,
pt2
);
pt1
=
new
Point
(
5.0
,
5.0
);
pt2
=
new
Point
(
25.0
,
5.0
);
pt1Clipped
=
new
Point
(
5.0
,
5.0
);
pt2Clipped
=
new
Point
(
25.0
,
5.0
);
res
=
core
.
clipLine
(
r
,
pt1
,
pt2
);
assertEquals
(
false
,
res
);
assertEquals
(
pt1Clipped
,
pt1
);
assertEquals
(
pt2Clipped
,
pt2
);
}
public
void
testCompare
()
{
public
void
testCompare
()
{
core
.
compare
(
gray0
,
gray0
,
dst
,
core
.
CMP_EQ
);
core
.
compare
(
gray0
,
gray0
,
dst
,
core
.
CMP_EQ
);
assertMatEqual
(
dst
,
gray255
);
assertMatEqual
(
dst
,
gray255
);
...
@@ -213,7 +239,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -213,7 +239,7 @@ public class coreTest extends OpenCVTestCase {
core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
1
);
core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
1
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
}
public
void
testConvertScaleAbsMatMatDoubleDouble
()
{
public
void
testConvertScaleAbsMatMatDoubleDouble
()
{
core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
2
,
2
);
core
.
convertScaleAbs
(
gray_16u_256
,
dst
,
2
,
2
);
assertMatEqual
(
gray255
,
dst
);
assertMatEqual
(
gray255
,
dst
);
...
@@ -329,6 +355,10 @@ public class coreTest extends OpenCVTestCase {
...
@@ -329,6 +355,10 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual
(
gray3
,
dst
);
assertMatEqual
(
gray3
,
dst
);
}
}
public
void
testEllipse2Poly
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalar
()
{
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalar
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
@@ -344,6 +374,18 @@ public class coreTest extends OpenCVTestCase {
...
@@ -344,6 +374,18 @@ public class coreTest extends OpenCVTestCase {
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt
()
{
public
void
testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testEllipseMatRotatedRectScalar
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatRotatedRectScalarInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEllipseMatRotatedRectScalarIntInt
()
{
fail
(
"Not yet implemented"
);
}
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
));
...
@@ -388,7 +430,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -388,7 +430,7 @@ public class coreTest extends OpenCVTestCase {
core
.
flip
(
src
,
dst
,
1
);
core
.
flip
(
src
,
dst
,
1
);
assertMatEqual
(
des_f1
,
dst
);
assertMatEqual
(
des_f1
,
dst
);
}
}
public
void
testGemmMatMatDoubleMatDoubleMat
()
{
public
void
testGemmMatMatDoubleMatDoubleMat
()
{
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
...
@@ -410,7 +452,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -410,7 +452,7 @@ public class coreTest extends OpenCVTestCase {
core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
);
core
.
gemm
(
m1
,
m2
,
1.0
,
dmatrix
,
1.0
,
dst
);
assertMatEqual
(
desired
,
dst
);
assertMatEqual
(
desired
,
dst
);
}
}
public
void
testGemmMatMatDoubleMatDoubleMatInt
()
{
public
void
testGemmMatMatDoubleMatDoubleMatInt
()
{
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m1
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m2
=
new
Mat
(
2
,
2
,
CvType
.
CV_32FC1
);
...
@@ -443,6 +485,10 @@ public class coreTest extends OpenCVTestCase {
...
@@ -443,6 +485,10 @@ public class coreTest extends OpenCVTestCase {
assertEquals
(
15
,
largeVecSize
);
assertEquals
(
15
,
largeVecSize
);
}
}
public
void
testGetTextSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGetTickFrequency
()
{
public
void
testGetTickFrequency
()
{
double
freq
=
0.0
;
double
freq
=
0.0
;
freq
=
core
.
getTickFrequency
();
freq
=
core
.
getTickFrequency
();
...
@@ -457,7 +503,6 @@ public class coreTest extends OpenCVTestCase {
...
@@ -457,7 +503,6 @@ public class coreTest extends OpenCVTestCase {
core
.
hconcat
(
e
,
dst
);
core
.
hconcat
(
e
,
dst
);
assertMatEqual
(
eConcat
,
dst
);
assertMatEqual
(
eConcat
,
dst
);
}
}
public
void
testIdctMatMat
()
{
public
void
testIdctMatMat
()
{
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
Mat
in
=
new
Mat
(
1
,
8
,
CvType
.
CV_32F
);
...
@@ -538,8 +583,6 @@ public class coreTest extends OpenCVTestCase {
...
@@ -538,8 +583,6 @@ public class coreTest extends OpenCVTestCase {
answer
.
put
(
1
,
1
,
1.0
);
answer
.
put
(
1
,
1
,
1.0
);
core
.
invert
(
src
,
dst
);
core
.
invert
(
src
,
dst
);
OpenCVTestRunner
.
Log
(
answer
.
dump
());
OpenCVTestRunner
.
Log
(
dst
.
dump
());
assertMatEqual
(
answer
,
dst
);
assertMatEqual
(
answer
,
dst
);
//TODO: needs epsilon comparison
//TODO: needs epsilon comparison
...
@@ -567,6 +610,14 @@ public class coreTest extends OpenCVTestCase {
...
@@ -567,6 +610,14 @@ public class coreTest extends OpenCVTestCase {
double
det
=
core
.
determinant
(
src
);
double
det
=
core
.
determinant
(
src
);
assertTrue
(
det
>
0.0
);
assertTrue
(
det
>
0.0
);
}
}
public
void
testKmeansMatIntMatTermCriteriaIntInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testKmeansMatIntMatTermCriteriaIntIntMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testLineMatPointPointScalar
()
{
public
void
testLineMatPointPointScalar
()
{
int
nPoints
=
Math
.
min
(
gray0
.
cols
(),
gray0
.
rows
());
int
nPoints
=
Math
.
min
(
gray0
.
cols
(),
gray0
.
rows
());
...
@@ -595,6 +646,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -595,6 +646,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testLineMatPointPointScalarIntInt
()
{
public
void
testLineMatPointPointScalarIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testLineMatPointPointScalarIntIntInt
()
{
public
void
testLineMatPointPointScalarIntIntInt
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
...
@@ -676,6 +728,17 @@ public class coreTest extends OpenCVTestCase {
...
@@ -676,6 +728,17 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual
(
dst
,
dst
);
assertMatEqual
(
dst
,
dst
);
}
}
public
void
testMeanMat
()
{
Scalar
mean
=
null
;
mean
=
core
.
mean
(
gray128
);
assertEquals
(
new
Scalar
(
128
),
mean
);
}
public
void
testMeanMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMeanStdDevMatMatMat
()
{
public
void
testMeanStdDevMatMatMat
()
{
Mat
mean
=
new
Mat
();
Mat
mean
=
new
Mat
();
Mat
stddev
=
new
Mat
();
Mat
stddev
=
new
Mat
();
...
@@ -710,6 +773,10 @@ public class coreTest extends OpenCVTestCase {
...
@@ -710,6 +773,10 @@ public class coreTest extends OpenCVTestCase {
assertTrue
(
0
!=
core
.
countNonZero
(
stddev
));
assertTrue
(
0
!=
core
.
countNonZero
(
stddev
));
}
}
public
void
testMerge
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMin
()
{
public
void
testMin
()
{
core
.
min
(
gray0
,
gray255
,
dst
);
core
.
min
(
gray0
,
gray255
,
dst
);
assertMatEqual
(
gray0
,
dst
);
assertMatEqual
(
gray0
,
dst
);
...
@@ -731,6 +798,14 @@ public class coreTest extends OpenCVTestCase {
...
@@ -731,6 +798,14 @@ public class coreTest extends OpenCVTestCase {
assertTrue
(
mmres
.
maxLoc
.
equals
(
maxLoc
));
assertTrue
(
mmres
.
maxLoc
.
equals
(
maxLoc
));
}
}
public
void
testMinMaxLocMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMinMaxLocMatMat
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMulSpectrumsMatMatMatInt
()
{
public
void
testMulSpectrumsMatMatMatInt
()
{
Mat
src1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
src1
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
src2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
Mat
src2
=
new
Mat
(
1
,
4
,
CvType
.
CV_32F
);
...
@@ -912,8 +987,6 @@ public class coreTest extends OpenCVTestCase {
...
@@ -912,8 +987,6 @@ public class coreTest extends OpenCVTestCase {
res
.
put
(
0
,
0
,
63.434
,
56.310
,
44.999
,
75.963
);
res
.
put
(
0
,
0
,
63.434
,
56.310
,
44.999
,
75.963
);
core
.
phase
(
x
,
y
,
dst
,
true
);
core
.
phase
(
x
,
y
,
dst
,
true
);
OpenCVTestRunner
.
Log
(
res
.
dump
());
OpenCVTestRunner
.
Log
(
dst
.
dump
());
}
}
public
void
testPolarToCartMatMatMatMat
()
{
public
void
testPolarToCartMatMatMatMat
()
{
...
@@ -937,10 +1010,6 @@ public class coreTest extends OpenCVTestCase {
...
@@ -937,10 +1010,6 @@ public class coreTest extends OpenCVTestCase {
//TODO: needs epsilon comparison
//TODO: needs epsilon comparison
core
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
core
.
polarToCart
(
magnitude
,
angle
,
xCoordinate
,
yCoordinate
);
OpenCVTestRunner
.
Log
(
x
.
dump
());
OpenCVTestRunner
.
Log
(
xCoordinate
.
dump
());
OpenCVTestRunner
.
Log
(
y
.
dump
());
OpenCVTestRunner
.
Log
(
yCoordinate
.
dump
());
assertMatEqual
(
x
,
xCoordinate
);
assertMatEqual
(
x
,
xCoordinate
);
}
}
...
@@ -952,7 +1021,23 @@ public class coreTest extends OpenCVTestCase {
...
@@ -952,7 +1021,23 @@ public class coreTest extends OpenCVTestCase {
core
.
pow
(
gray3
,
2.0
,
dst
);
core
.
pow
(
gray3
,
2.0
,
dst
);
assertMatEqual
(
gray9
,
dst
);
assertMatEqual
(
gray9
,
dst
);
}
}
public
void
testPutTextMatStringPointIntDoubleScalar
()
{
fail
(
"Not yet implemented"
);
}
public
void
testPutTextMatStringPointIntDoubleScalarInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testPutTextMatStringPointIntDoubleScalarIntInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testPutTextMatStringPointIntDoubleScalarIntIntBoolean
()
{
fail
(
"Not yet implemented"
);
}
public
void
testRandn
()
{
public
void
testRandn
()
{
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
low
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
0
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
Mat
high
=
new
Mat
(
1
,
1
,
CvType
.
CV_16UC1
,
new
Scalar
(
256
));
...
@@ -980,7 +1065,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -980,7 +1065,7 @@ public class coreTest extends OpenCVTestCase {
core
.
rectangle
(
gray0
,
center
,
origin
,
color
);
core
.
rectangle
(
gray0
,
center
,
origin
,
color
);
assertTrue
(
0
!=
core
.
countNonZero
(
gray0
));
assertTrue
(
0
!=
core
.
countNonZero
(
gray0
));
}
}
public
void
testRectangleMatPointPointScalarInt
()
{
public
void
testRectangleMatPointPointScalarInt
()
{
Point
center
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
Point
center
=
new
Point
(
gray0
.
cols
(),
gray0
.
rows
());
Point
origin
=
new
Point
(
0
,
0
);
Point
origin
=
new
Point
(
0
,
0
);
...
@@ -1113,10 +1198,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -1113,10 +1198,7 @@ public class coreTest extends OpenCVTestCase {
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
Mat
answer
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
Mat
answer
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
//FIXME: doesn't work answer.put(0, 0, 1, 0, 2, 0, 3, 0);
answer
.
put
(
0
,
0
,
1
,
0
,
2
,
0
,
3
,
0
);
answer
.
put
(
0
,
0
,
1
,
0
);
answer
.
put
(
1
,
0
,
2
,
0
);
answer
.
put
(
2
,
0
,
3
,
0
);
core
.
solvePoly
(
coeffs
,
roots
);
core
.
solvePoly
(
coeffs
,
roots
);
assertMatEqual
(
answer
,
roots
);
assertMatEqual
(
answer
,
roots
);
...
@@ -1129,10 +1211,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -1129,10 +1211,7 @@ public class coreTest extends OpenCVTestCase {
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
coeffs
.
put
(
0
,
0
,
-
6
,
11
,
-
6
,
1
);
Mat
answer
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
Mat
answer
=
new
Mat
(
3
,
1
,
CvType
.
CV_32FC2
);
//FIXME: doesn't work answer.put(0, 0, 1, 0, 2, 0, 3, 0);
answer
.
put
(
0
,
0
,
1
,
0
,
-
1
,
2
,
-
2
,
12
);
answer
.
put
(
0
,
0
,
1
,
0
);
answer
.
put
(
1
,
0
,
-
1
,
2
);
answer
.
put
(
2
,
0
,
-
2
,
12
);
core
.
solvePoly
(
coeffs
,
roots
,
1
);
core
.
solvePoly
(
coeffs
,
roots
,
1
);
assertMatEqual
(
answer
,
roots
);
assertMatEqual
(
answer
,
roots
);
...
@@ -1164,6 +1243,17 @@ public class coreTest extends OpenCVTestCase {
...
@@ -1164,6 +1243,17 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual
(
answer
,
b
);
assertMatEqual
(
answer
,
b
);
}
}
public
void
testSplit
()
{
fail
(
"Not yet implemented"
);
//FIXME: must work
//ArrayList<Mat> cois = new ArrayList<Mat>();
//core.split(rgba0, cois);
// for(Mat coi : cois) {
// OpenCVTestRunner.Log(coi.toString());
// //assertMatEqual(gray0, coi);
// }
}
public
void
testSqrt
()
{
public
void
testSqrt
()
{
core
.
sqrt
(
gray9_32f
,
dst
);
core
.
sqrt
(
gray9_32f
,
dst
);
assertMatEqual
(
gray3_32f
,
dst
);
assertMatEqual
(
gray3_32f
,
dst
);
...
@@ -1198,6 +1288,14 @@ public class coreTest extends OpenCVTestCase {
...
@@ -1198,6 +1288,14 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual
(
gray1_32f
,
dst
);
assertMatEqual
(
gray1_32f
,
dst
);
}
}
public
void
testSumElems
()
{
fail
(
"Not yet implemented"
);
}
public
void
testTrace
()
{
fail
(
"Not yet implemented"
);
}
public
void
testTransform
()
{
public
void
testTransform
()
{
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
,
new
Scalar
(
55
));
Mat
src
=
new
Mat
(
2
,
2
,
CvType
.
CV_32F
,
new
Scalar
(
55
));
Mat
m
=
Mat
.
eye
(
2
,
2
,
CvType
.
CV_32FC1
);
Mat
m
=
Mat
.
eye
(
2
,
2
,
CvType
.
CV_32FC1
);
...
...
modules/java/android_test/src/org/opencv/test/objdetect/CascadeClassifierTest.java
0 → 100644
View file @
51922658
package
org
.
opencv
.
test
.
objdetect
;
import
java.util.ArrayList
;
import
org.opencv.Mat
;
import
org.opencv.Rect
;
import
org.opencv.Size
;
import
org.opencv.imgproc
;
import
org.opencv.objdetect.CascadeClassifier
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
public
class
CascadeClassifierTest
extends
OpenCVTestCase
{
private
CascadeClassifier
cc
;
@Override
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
cc
=
null
;
}
public
void
testCascadeClassifier
()
{
cc
=
new
CascadeClassifier
();
assertTrue
(
null
!=
cc
);
}
public
void
testCascadeClassifierString
()
{
cc
=
new
CascadeClassifier
(
OpenCVTestRunner
.
LBPCASCADE_FRONTALFACE_PATH
);
assertTrue
(
null
!=
cc
);
}
public
void
testDetectMultiScaleMatListOfRect
()
{
CascadeClassifier
cc
=
new
CascadeClassifier
(
OpenCVTestRunner
.
LBPCASCADE_FRONTALFACE_PATH
);
ArrayList
<
Rect
>
faces
=
new
ArrayList
<
Rect
>();
Mat
greyLena
=
new
Mat
();
imgproc
.
cvtColor
(
rgbLena
,
greyLena
,
imgproc
.
CV_RGB2GRAY
);
//TODO: doesn't detect with 1.1 scale
cc
.
detectMultiScale
(
greyLena
,
faces
,
1.09
,
2
,
2
/*TODO: CV_HAAR_SCALE_IMAGE*/
,
new
Size
(
30
,
30
));
assertEquals
(
1
,
faces
.
size
());
}
public
void
testDetectMultiScaleMatListOfRectDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectDoubleInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectDoubleIntInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectDoubleIntIntSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectDoubleIntIntSizeSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSizeBoolean
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEmpty
()
{
cc
=
new
CascadeClassifier
();
assertTrue
(
cc
.
empty
());
}
public
void
testLoad
()
{
cc
=
new
CascadeClassifier
();
cc
.
load
(
OpenCVTestRunner
.
LBPCASCADE_FRONTALFACE_PATH
);
assertTrue
(!
cc
.
empty
());
}
}
modules/java/android_test/src/org/opencv/test/objdetect/objdetectTest.java
View file @
51922658
...
@@ -2,39 +2,47 @@ package org.opencv.test.objdetect;
...
@@ -2,39 +2,47 @@ package org.opencv.test.objdetect;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
org.opencv.
Ma
t
;
import
org.opencv.
Rec
t
;
import
org.opencv.objdetect
;
import
org.opencv.objdetect
;
import
org.opencv.highgui
;
import
org.opencv.core
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
org.opencv.Rect
;
import
org.opencv.Size
;
import
org.opencv.Scalar
;
public
class
objdetectTest
extends
OpenCVTestCase
{
public
class
objdetectTest
extends
OpenCVTestCase
{
public
void
testCascadeClassifierFaceDetector
()
{
objdetect
.
CascadeClassifier
cc
=
new
objdetect
.
CascadeClassifier
(
"/mnt/sdcard/lbpcascade_frontalface.xml"
);
public
void
testGroupRectanglesListOfRectInt
()
{
///objdetect.CascadeClassifier cc=new objdetect.CascadeClassifier("/mnt/sdcard/haarcascade_frontalface_alt2.xml");
Rect
r
=
new
Rect
(
10
,
10
,
20
,
20
);
ArrayList
<
Rect
>
faces
=
new
ArrayList
<
Rect
>();
ArrayList
<
Rect
>
rects
=
new
ArrayList
<
Rect
>();
Mat
shot002
=
highgui
.
imread
(
"/mnt/sdcard/shot0002.png"
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
OpenCVTestRunner
.
Log
(
"after imread shot002"
);
rects
.
add
(
r
);
cc
.
detectMultiScale
(
shot002
,
faces
,
1.1
,
2
,
2
/*TODO: CV_HAAR_SCALE_IMAGE*/
,
new
Size
(
10
,
10
));
int
groupThreshold
=
1
;
OpenCVTestRunner
.
Log
(
"faces.size="
+
faces
.
size
());
objdetect
.
groupRectangles
(
rects
,
groupThreshold
);
assertEquals
(
1
,
rects
.
size
());
}
public
void
testGroupRectanglesListOfRectIntDouble
()
{
Rect
r1
=
new
Rect
(
10
,
10
,
20
,
20
);
Rect
r2
=
new
Rect
(
10
,
10
,
25
,
25
);
ArrayList
<
Rect
>
rects
=
new
ArrayList
<
Rect
>();
Scalar
color
=
new
Scalar
(
0
,
255
,
0
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
for
(
int
i
=
0
;
i
<
faces
.
size
();
i
++)
{
rects
.
add
(
r1
);
OpenCVTestRunner
.
Log
(
"face["
+
i
+
"]="
+
faces
.
get
(
i
).
toString
());
for
(
int
i
=
0
;
i
<
10
;
i
++)
core
.
rectangle
(
shot002
,
faces
.
get
(
i
).
tl
(),
faces
.
get
(
i
).
br
(),
color
);
rects
.
add
(
r2
);
}
OpenCVTestRunner
.
Log
(
"before writing image"
);
boolean
reswrite
=
highgui
.
imwrite
(
"/mnt/sdcard/lbpcascade_frontalface_res.jpg"
,
shot002
);
OpenCVTestRunner
.
Log
(
"after writing image, res="
+
reswrite
);
int
groupThreshold
=
1
;
double
eps
=
0.2
;
objdetect
.
groupRectangles
(
rects
,
groupThreshold
,
eps
);
assertEquals
(
2
,
rects
.
size
());
}
public
void
testGroupRectanglesListOfRectListOfIntegerInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testGroupRectanglesListOfRectListOfIntegerIntDouble
()
{
fail
(
"Not yet implemented"
);
}
}
}
}
modules/java/android_test/src/org/opencv/test/video/videoTest.java
View file @
51922658
package
org
.
opencv
.
test
.
video
;
package
org
.
opencv
.
test
.
video
;
import
org.opencv.CvType
;
import
org.opencv.Mat
;
import
org.opencv.Size
;
import
org.opencv.core
;
import
org.opencv.video
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestCase
;
public
class
videoTest
extends
OpenCVTestCase
{
public
class
videoTest
extends
OpenCVTestCase
{
private
int
shift1
;
private
int
shift2
;
private
int
w
;
private
int
h
;
private
Mat
subLena1
=
null
;
private
Mat
subLena2
=
null
;
private
Mat
nextPts
=
null
;
private
Mat
status
=
null
;
private
Mat
err
=
null
;
@Override
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
shift1
=
10
;
shift2
=
17
;
w
=
rgbLena
.
cols
()
/
2
;
h
=
rgbLena
.
rows
()
/
2
;
subLena1
=
rgbLena
.
submat
(
shift1
,
h
+
shift1
,
shift1
,
w
+
shift1
);
subLena2
=
rgbLena
.
submat
(
shift2
,
h
+
shift2
,
shift2
,
w
+
shift2
);
nextPts
=
new
Mat
();
status
=
new
Mat
();
err
=
new
Mat
();
}
public
void
testCalcGlobalOrientation
()
{
public
void
testCalcGlobalOrientation
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
...
@@ -21,10 +55,55 @@ public class videoTest extends OpenCVTestCase {
...
@@ -21,10 +55,55 @@ public class videoTest extends OpenCVTestCase {
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMat
()
{
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
);
video
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
);
assertEquals
(
3
,
core
.
countNonZero
(
status
));
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSize
()
{
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
);
Size
sz
=
new
Size
(
5
,
5
);
video
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
,
sz
);
assertEquals
(
0
,
core
.
countNonZero
(
status
));
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeIntTermCriteria
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeIntTermCriteriaDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeIntTermCriteriaDoubleInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCamShift
()
{
fail
(
"Not yet implemented"
);
}
public
void
testEstimateRigidTransform
()
{
public
void
testEstimateRigidTransform
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testMeanShift
()
{
fail
(
"Not yet implemented"
);
}
public
void
testSegmentMotion
()
{
fail
(
"Not yet implemented"
);
}
public
void
testUpdateMotionHistory
()
{
public
void
testUpdateMotionHistory
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
...
modules/java/gen_java.py
View file @
51922658
...
@@ -6,6 +6,34 @@ try:
...
@@ -6,6 +6,34 @@ try:
except
:
except
:
from
StringIO
import
StringIO
from
StringIO
import
StringIO
class_ignore_list
=
(
#core
"FileNode"
,
"FileStorage"
,
#highgui
"VideoWriter"
,
"VideoCapture"
,
)
func_ignore_list
=
(
#core
"checkHardwareSupport"
,
"setUseOptimized"
,
"useOptimized"
,
"vconcat"
,
#highgui
"namedWindow"
,
"destroyWindow"
,
"destroyAllWindows"
,
"startWindowThread"
,
"setWindowProperty"
,
"getWindowProperty"
,
"getTrackbarPos"
,
"setTrackbarPos"
,
"imshow"
,
"waitKey"
,
)
const_ignore_list
=
(
const_ignore_list
=
(
"CV_CAP_OPENNI"
,
"CV_CAP_OPENNI"
,
"CV_CAP_PROP_OPENNI_"
,
"CV_CAP_PROP_OPENNI_"
,
...
@@ -73,23 +101,6 @@ const_ignore_list = (
...
@@ -73,23 +101,6 @@ const_ignore_list = (
"CV_CAP_PROP_PVAPI_MULTICASTIP"
,
"CV_CAP_PROP_PVAPI_MULTICASTIP"
,
)
)
func_ignore_list
=
(
"namedWindow"
,
"destroyWindow"
,
"destroyAllWindows"
,
"startWindowThread"
,
"setWindowProperty"
,
"getWindowProperty"
,
"getTrackbarPos"
,
"setTrackbarPos"
,
"imshow"
,
"waitKey"
,
)
class_ignore_list
=
(
"VideoWriter"
,
"VideoCapture"
,
)
# c_type : { java/jni correspondence }
# c_type : { java/jni correspondence }
type_dict
=
{
type_dict
=
{
...
...
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