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
56e26b96
Commit
56e26b96
authored
Jun 30, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit of JavaAPI unit tests
parent
64c8d8f2
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
239 additions
and
0 deletions
+239
-0
.classpath
modules/java/android_test/.classpath
+8
-0
.project
modules/java/android_test/.project
+41
-0
AndroidManifest.xml
modules/java/android_test/AndroidManifest.xml
+13
-0
default.properties
modules/java/android_test/default.properties
+12
-0
icon.png
modules/java/android_test/res/drawable-hdpi/icon.png
+0
-0
icon.png
modules/java/android_test/res/drawable-ldpi/icon.png
+0
-0
icon.png
modules/java/android_test/res/drawable-mdpi/icon.png
+0
-0
main.xml
modules/java/android_test/res/layout/main.xml
+12
-0
strings.xml
modules/java/android_test/res/values/strings.xml
+5
-0
CoreTest.java
modules/java/android_test/src/org/opencv_test/CoreTest.java
+25
-0
ImgprocTest.java
...es/java/android_test/src/org/opencv_test/ImgprocTest.java
+35
-0
MatTest.java
modules/java/android_test/src/org/opencv_test/MatTest.java
+30
-0
OpenCvTestCase.java
...java/android_test/src/org/opencv_test/OpenCvTestCase.java
+58
-0
No files found.
modules/java/android_test/.classpath
0 → 100644
View file @
56e26b96
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"src"
path=
"gen"
/>
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"
/>
<classpathentry
kind=
"src"
path=
"OpenCVJavaAPI_src"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
modules/java/android_test/.project
0 → 100644
View file @
56e26b96
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
OpenCV_Test
</name>
<comment></comment>
<projects>
<project>
OpenCVJavaAPI
</project>
</projects>
<buildSpec>
<buildCommand>
<name>
com.android.ide.eclipse.adt.ResourceManagerBuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
com.android.ide.eclipse.adt.PreCompilerBuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
com.android.ide.eclipse.adt.ApkBuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
com.android.ide.eclipse.adt.AndroidNature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
<linkedResources>
<link>
<name>
OpenCVJavaAPI_src
</name>
<type>
2
</type>
<locationURI>
_android_OpenCVJavaAPI_583dbd7b/src
</locationURI>
</link>
</linkedResources>
</projectDescription>
modules/java/android_test/AndroidManifest.xml
0 → 100644
View file @
56e26b96
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.opencv_test"
android:versionCode=
"1"
android:versionName=
"1.0"
>
<uses-sdk
android:minSdkVersion=
"8"
/>
<instrumentation
android:targetPackage=
"org.opencv_test"
android:name=
"android.test.InstrumentationTestRunner"
/>
<application
android:icon=
"@drawable/icon"
android:label=
"@string/app_name"
>
<uses-library
android:name=
"android.test.runner"
/>
</application>
</manifest>
\ No newline at end of file
modules/java/android_test/default.properties
0 → 100644
View file @
56e26b96
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target
=
android-8
android.library.reference.1
=
../android/build
modules/java/android_test/res/drawable-hdpi/icon.png
0 → 100644
View file @
56e26b96
4.05 KB
modules/java/android_test/res/drawable-ldpi/icon.png
0 → 100644
View file @
56e26b96
1.68 KB
modules/java/android_test/res/drawable-mdpi/icon.png
0 → 100644
View file @
56e26b96
2.51 KB
modules/java/android_test/res/layout/main.xml
0 → 100644
View file @
56e26b96
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
>
<TextView
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/hello"
/>
</LinearLayout>
modules/java/android_test/res/values/strings.xml
0 → 100644
View file @
56e26b96
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"hello"
>
Hello World!
</string>
<string
name=
"app_name"
>
OpenCV_Test
</string>
</resources>
modules/java/android_test/src/org/opencv_test/CoreTest.java
0 → 100644
View file @
56e26b96
package
org
.
opencv_test
;
import
org.opencv.core
;
public
class
CoreTest
extends
OpenCvTestCase
{
public
void
test_1
()
{
super
.
test_1
(
"CORE"
);
}
public
void
test_Can_Call_add
()
{
core
.
add
(
gray128
,
gray128
,
dst
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
test_Can_Call_absdiff
()
{
core
.
absdiff
(
gray128
,
gray255
,
dst
);
assertMatEqual
(
gray127
,
dst
);
}
public
void
test_Can_Call_bitwise_and
()
{
core
.
bitwise_and
(
gray3
,
gray2
,
dst
);
assertMatEqual
(
gray2
,
dst
);
}
}
modules/java/android_test/src/org/opencv_test/ImgprocTest.java
0 → 100644
View file @
56e26b96
package
org
.
opencv_test
;
import
org.opencv.Mat
;
import
org.opencv.Size
;
import
org.opencv.imgproc
;
public
class
ImgprocTest
extends
OpenCvTestCase
{
public
void
test_1
()
{
super
.
test_1
(
"IMGPROC"
);
}
//FIXME: this test crashes
//public void test_Can_Call_accumulate() {
// dst = new Mat(gray1.rows(), gray1.cols(), Mat.CvType.CV_32FC1);
// imgproc.accumulate(gray1, dst);
// assertMatEqual(gray1, dst);
//}
public
void
test_blur
()
{
Size
sz
=
new
Size
(
3
,
3
);
imgproc
.
blur
(
gray0
,
dst
,
sz
);
assertMatEqual
(
gray0
,
dst
);
imgproc
.
blur
(
gray255
,
dst
,
sz
);
assertMatEqual
(
gray255
,
dst
);
}
public
void
test_boxFilter
()
{
Size
sz
=
new
Size
(
3
,
3
);
imgproc
.
boxFilter
(
gray0
,
dst
,
8
,
sz
);
assertMatEqual
(
gray0
,
dst
);
}
}
modules/java/android_test/src/org/opencv_test/MatTest.java
0 → 100644
View file @
56e26b96
package
org
.
opencv_test
;
import
org.opencv.Mat
;
public
class
MatTest
extends
OpenCvTestCase
{
public
void
test_1
()
{
super
.
test_1
(
"Mat"
);
}
public
void
test_Can_Create_Gray_Mat
()
{
Mat
m
=
new
Mat
(
1
,
1
,
Mat
.
CvType
.
CV_8UC1
);
assertFalse
(
m
.
empty
());
}
public
void
test_Can_Create_RBG_Mat
()
{
Mat
m
=
new
Mat
(
1
,
1
,
Mat
.
CvType
.
CV_8UC3
);
assertFalse
(
m
.
empty
());
}
public
void
test_Can_Get_Cols
()
{
Mat
m
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
assertEquals
(
10
,
m
.
rows
());
}
public
void
test_Can_Get_Rows
()
{
Mat
m
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
assertEquals
(
10
,
m
.
rows
());
}
}
modules/java/android_test/src/org/opencv_test/OpenCvTestCase.java
0 → 100644
View file @
56e26b96
package
org
.
opencv_test
;
import
org.opencv.Mat
;
import
org.opencv.core
;
import
android.test.AndroidTestCase
;
import
android.util.Log
;
public
class
OpenCvTestCase
extends
AndroidTestCase
{
static
String
TAG
=
"OpenCV"
;
static
Mat
gray0
;
static
Mat
gray1
;
static
Mat
gray2
;
static
Mat
gray3
;
static
Mat
gray127
;
static
Mat
gray128
;
static
Mat
gray255
;
static
Mat
dst
;
@Override
protected
void
setUp
()
throws
Exception
{
//Log.e(TAG, "setUp");
super
.
setUp
();
gray0
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray0
.
setTo
(
0.0
);
gray1
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray1
.
setTo
(
1.0
);
gray2
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray2
.
setTo
(
2.0
);
gray3
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray3
.
setTo
(
3.0
);
gray127
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray127
.
setTo
(
127.0
);
gray128
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray128
.
setTo
(
128.0
);
gray255
=
new
Mat
(
10
,
10
,
Mat
.
CvType
.
CV_8UC1
);
gray255
.
setTo
(
256.0
);
dst
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_8UC1
);
assertTrue
(
dst
.
empty
());
}
public
static
void
assertMatEqual
(
Mat
m1
,
Mat
m2
)
{
assertTrue
(
MatDifference
(
m1
,
m2
)
==
0.0
);
}
static
public
double
MatDifference
(
Mat
m1
,
Mat
m2
)
{
Mat
cmp
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_8UC1
);
core
.
compare
(
m1
,
m2
,
cmp
,
core
.
CMP_EQ
);
double
num
=
100.0
*
(
1.0
-
Double
.
valueOf
(
core
.
countNonZero
(
cmp
))
/
Double
.
valueOf
(
cmp
.
rows
()
*
cmp
.
cols
()));
return
num
;
}
public
void
test_1
(
String
label
)
{
Log
.
e
(
TAG
,
"================================================"
);
Log
.
e
(
TAG
,
"=============== "
+
label
);
Log
.
e
(
TAG
,
"================================================"
);
}
}
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