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
1649c8f6
Commit
1649c8f6
authored
Jul 04, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some tests for highgui java added
parent
5596c792
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
10 deletions
+104
-10
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+27
-3
coreTest.java
modules/java/android_test/src/org/opencv/test/coreTest.java
+9
-6
highguiTest.java
...es/java/android_test/src/org/opencv/test/highguiTest.java
+68
-1
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
1649c8f6
package
org
.
opencv
.
test
;
package
org
.
opencv
.
test
;
import
java.io.FileOutputStream
;
import
org.opencv.Mat
;
import
org.opencv.Mat
;
import
org.opencv.core
;
import
org.opencv.core
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Bitmap.CompressFormat
;
import
android.test.AndroidTestCase
;
import
android.test.AndroidTestCase
;
import
android.util.Log
;
import
android.util.Log
;
public
class
OpenCVTestCase
extends
AndroidTestCase
{
public
class
OpenCVTestCase
extends
AndroidTestCase
{
static
String
TAG
=
"OpenCV_JavaAPI_Tests"
;
static
String
TAG
=
"OpenCV_JavaAPI_Tests"
;
static
String
LENA
=
"/data/data/org.opencv.test/files/lena.jpg"
;
static
int
matSize
=
10
;
static
int
matSize
=
10
;
static
Mat
gray0
;
static
Mat
gray0
;
...
@@ -42,6 +50,11 @@ public class OpenCVTestCase extends AndroidTestCase {
...
@@ -42,6 +50,11 @@ public class OpenCVTestCase extends AndroidTestCase {
protected
void
setUp
()
throws
Exception
{
protected
void
setUp
()
throws
Exception
{
// Log.e(TAG, "setUp");
// Log.e(TAG, "setUp");
super
.
setUp
();
super
.
setUp
();
//Naming notation: channels_[type]_[dimension]_value
//examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d - refactor ;)
gray0
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray0
.
setTo
(
0.0
);
gray0
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray0
.
setTo
(
0.0
);
gray1
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray1
.
setTo
(
1.0
);
gray1
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray1
.
setTo
(
1.0
);
...
@@ -67,11 +80,22 @@ public class OpenCVTestCase extends AndroidTestCase {
...
@@ -67,11 +80,22 @@ public class OpenCVTestCase extends AndroidTestCase {
gray0_64f_1d
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
gray0_64f_1d
.
setTo
(
0.0
);
gray0_64f_1d
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
gray0_64f_1d
.
setTo
(
0.0
);
rgba0
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC4
);
rgba0
.
setTo
(
0
,
0
,
0
,
0
);
rgba0
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC4
);
rgba0
.
setTo
(
0
,
0
,
0
,
0
);
rgba128
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC4
);
rgba128
.
setTo
(
128
,
128
,
128
,
128
);
rgba128
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC4
);
rgba128
.
setTo
(
128
,
128
,
128
,
128
);
try
{
Bitmap
mBitmap
=
BitmapFactory
.
decodeResource
(
this
.
getContext
().
getResources
(),
R
.
drawable
.
lena
);
FileOutputStream
fos
=
this
.
getContext
().
openFileOutput
(
"lena.jpg"
,
Context
.
MODE_WORLD_READABLE
);
mBitmap
.
compress
(
CompressFormat
.
JPEG
,
100
,
fos
);
fos
.
flush
();
fos
.
close
();
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Tried to write lena.jpg, but: "
+
e
.
toString
());
}
dst_gray
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_8UC1
);
dst_gray
=
new
Mat
();
assertTrue
(
dst_gray
.
empty
());
assertTrue
(
dst_gray
.
empty
());
dst_gray_32f
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_32FC1
);
dst_gray_32f
=
new
Mat
();
assertTrue
(
dst_gray_32f
.
empty
());
assertTrue
(
dst_gray_32f
.
empty
());
}
}
...
...
modules/java/android_test/src/org/opencv/test/coreTest.java
View file @
1649c8f6
...
@@ -30,7 +30,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -30,7 +30,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testMahalanobis
()
{
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
instead of magic numbers
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
());
...
@@ -110,7 +110,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -110,7 +110,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
instead of magic numbers
assertMatEqual
(
gray0_32f
,
covar
);
assertMatEqual
(
gray0_32f
,
covar
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
}
}
...
@@ -119,7 +119,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -119,7 +119,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
);
//FIXME: CV_COVAR_NORMAL
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
);
//FIXME: CV_COVAR_NORMAL
instead of magic numbers
assertMatEqual
(
gray0_64f
,
covar
);
assertMatEqual
(
gray0_64f
,
covar
);
assertMatEqual
(
gray0_64f_1d
,
mean
);
assertMatEqual
(
gray0_64f_1d
,
mean
);
}
}
...
@@ -133,7 +133,8 @@ public class coreTest extends OpenCVTestCase {
...
@@ -133,7 +133,8 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testCheckHardwareSupport
()
{
public
void
testCheckHardwareSupport
()
{
boolean
hasFeauture
=
core
.
checkHardwareSupport
(
0
);
//FIXME: do we need this function?
//FIXME: do we need this function?
boolean
hasFeauture
=
core
.
checkHardwareSupport
(
0
);
assertEquals
(
false
,
hasFeauture
);
assertEquals
(
false
,
hasFeauture
);
}
}
...
@@ -414,7 +415,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -414,7 +415,7 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testMulSpectrumsMatMatMatInt
()
{
public
void
testMulSpectrumsMatMatMatInt
()
{
//TODO:
complex math. See the dct function test.
//TODO:
nice example
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
@@ -498,7 +499,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -498,7 +499,7 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testPerspectiveTransform
()
{
public
void
testPerspectiveTransform
()
{
//
XXX: kirill stopped her
e
//
TODO: nice exampl
e
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
@@ -571,6 +572,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -571,6 +572,7 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testSetUseOptimized
()
{
public
void
testSetUseOptimized
()
{
//FIXME: do we need this function?
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
@@ -627,6 +629,7 @@ public class coreTest extends OpenCVTestCase {
...
@@ -627,6 +629,7 @@ public class coreTest extends OpenCVTestCase {
}
}
public
void
testUseOptimized
()
{
public
void
testUseOptimized
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
...
modules/java/android_test/src/org/opencv/test/highguiTest.java
View file @
1649c8f6
package
org
.
opencv
.
test
;
package
org
.
opencv
.
test
;
import
java.io.FileOutputStream
;
import
org.opencv.Mat
;
import
org.opencv.highgui
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap.CompressFormat
;
import
android.graphics.BitmapFactory
;
import
android.util.Log
;
public
class
highguiTest
extends
OpenCVTestCase
{
public
class
highguiTest
extends
OpenCVTestCase
{
public
void
testDestroyAllWindows
()
{
public
void
testDestroyAllWindows
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testDestroyWindow
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testGetTrackbarPos
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testGetWindowProperty
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testImdecode
()
{
public
void
testImdecode
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testImreadStringInt
()
{
dst_gray
=
highgui
.
imread
(
LENA
,
0
);
assertTrue
(!
dst_gray
.
empty
());
assertEquals
(
1
,
dst_gray
.
channels
());
}
public
void
testStartWindowThread
()
{
public
void
testImreadString
()
{
dst_gray
=
highgui
.
imread
(
LENA
);
assertTrue
(!
dst_gray
.
empty
());
assertEquals
(
3
,
dst_gray
.
channels
());
}
public
void
testImshow
()
{
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testNamedWindowStringInt
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testNamedWindowString
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testSetTrackbarPos
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testSetWindowProperty
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testStartWindowThread
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testWaitKeyInt
()
{
public
void
testWaitKeyInt
()
{
//XXX: we need this function if only imshow will be implemented
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
public
void
testWaitKey
()
{
public
void
testWaitKey
()
{
//XXX: we need this function if only imshow will be implemented
fail
(
"Not yet implemented"
);
fail
(
"Not yet implemented"
);
}
}
...
...
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