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
5bea651e
Commit
5bea651e
authored
Feb 24, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java samples updated to be compatible with both old (2.2+) and new (3.0+) Android versions
parent
b6c2c61c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
87 additions
and
70 deletions
+87
-70
.classpath
modules/java/android_test/.classpath
+0
-1
.project
modules/java/android_test/.project
+33
-40
AndroidManifest.xml
samples/android/tutorial-0-androidcamera/AndroidManifest.xml
+6
-5
project.properties
samples/android/tutorial-0-androidcamera/project.properties
+1
-1
SampleViewBase.java
...mera/src/org/opencv/samples/tutorial0/SampleViewBase.java
+11
-5
project.properties
samples/android/tutorial-1-addopencv/project.properties
+1
-1
SampleViewBase.java
...encv/src/org/opencv/samples/tutorial1/SampleViewBase.java
+11
-5
project.properties
samples/android/tutorial-3-native/project.properties
+1
-1
SampleViewBase.java
...tive/src/org/opencv/samples/tutorial3/SampleViewBase.java
+11
-5
project.properties
samples/android/tutorial-4-mixed/project.properties
+1
-1
SampleViewBase.java
...ixed/src/org/opencv/samples/tutorial4/SampleViewBase.java
+11
-5
No files found.
modules/java/android_test/.classpath
View file @
5bea651e
...
...
@@ -4,7 +4,6 @@
<classpathentry
kind=
"src"
path=
"gen"
/>
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.junit.JUNIT_CONTAINER/4"
/>
<classpathentry
kind=
"src"
path=
"OpenCV_src"
/>
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.LIBRARIES"
/>
<classpathentry
kind=
"output"
path=
"bin/classes"
/>
</classpath>
modules/java/android_test/.project
View file @
5bea651e
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
OpenCV_JavaAPI_Tests
</name>
<comment></comment>
<projects>
</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>
OpenCV_src
</name>
<type>
2
</type>
<locationURI>
_android_OpenCV_8d28b05d/src
</locationURI>
</link>
</linkedResources>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
OpenCV_JavaAPI_Tests
</name>
<comment></comment>
<projects>
</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>
</projectDescription>
samples/android/tutorial-0-androidcamera/AndroidManifest.xml
View file @
5bea651e
...
...
@@ -10,6 +10,12 @@
android:largeScreens=
"true"
android:anyDensity=
"true"
/>
<uses-sdk
android:minSdkVersion=
"8"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-feature
android:name=
"android.hardware.camera"
/>
<uses-feature
android:name=
"android.hardware.camera.autofocus"
/>
<application
android:label=
"@string/app_name"
android:icon=
"@drawable/icon"
>
<activity
android:name=
"Sample0Base"
android:label=
"@string/app_name"
...
...
@@ -22,10 +28,5 @@
</activity>
</application>
<uses-sdk
android:minSdkVersion=
"8"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-feature
android:name=
"android.hardware.camera"
/>
<uses-feature
android:name=
"android.hardware.camera.autofocus"
/>
</manifest>
samples/android/tutorial-0-androidcamera/project.properties
View file @
5bea651e
# Project target.
target
=
android-
8
target
=
android-
11
samples/android/tutorial-0-androidcamera/src/org/opencv/samples/tutorial0/SampleViewBase.java
View file @
5bea651e
...
...
@@ -6,8 +6,10 @@ import java.util.List;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.SurfaceTexture
;
import
android.hardware.Camera
;
import
android.hardware.Camera.PreviewCallback
;
import
android.os.Build
;
import
android.util.Log
;
import
android.view.SurfaceHolder
;
import
android.view.SurfaceView
;
...
...
@@ -59,11 +61,15 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
params
.
setPreviewSize
(
getFrameWidth
(),
getFrameHeight
());
mCamera
.
setParameters
(
params
);
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
mCamera
.
setPreviewTexture
(
new
SurfaceTexture
(
10
)
);
}
else
{
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
}
mCamera
.
startPreview
();
}
}
...
...
samples/android/tutorial-1-addopencv/project.properties
View file @
5bea651e
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-
8
target
=
android-
11
samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/SampleViewBase.java
View file @
5bea651e
...
...
@@ -6,8 +6,10 @@ import java.util.List;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.SurfaceTexture
;
import
android.hardware.Camera
;
import
android.hardware.Camera.PreviewCallback
;
import
android.os.Build
;
import
android.util.Log
;
import
android.view.SurfaceHolder
;
import
android.view.SurfaceView
;
...
...
@@ -59,11 +61,15 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
params
.
setPreviewSize
(
getFrameWidth
(),
getFrameHeight
());
mCamera
.
setParameters
(
params
);
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
mCamera
.
setPreviewTexture
(
new
SurfaceTexture
(
10
)
);
}
else
{
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
}
mCamera
.
startPreview
();
}
}
...
...
samples/android/tutorial-3-native/project.properties
View file @
5bea651e
# Project target.
target
=
android-
8
target
=
android-
11
samples/android/tutorial-3-native/src/org/opencv/samples/tutorial3/SampleViewBase.java
View file @
5bea651e
...
...
@@ -6,8 +6,10 @@ import java.util.List;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.SurfaceTexture
;
import
android.hardware.Camera
;
import
android.hardware.Camera.PreviewCallback
;
import
android.os.Build
;
import
android.util.Log
;
import
android.view.SurfaceHolder
;
import
android.view.SurfaceView
;
...
...
@@ -59,11 +61,15 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
params
.
setPreviewSize
(
getFrameWidth
(),
getFrameHeight
());
mCamera
.
setParameters
(
params
);
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
mCamera
.
setPreviewTexture
(
new
SurfaceTexture
(
10
)
);
}
else
{
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
}
mCamera
.
startPreview
();
}
}
...
...
samples/android/tutorial-4-mixed/project.properties
View file @
5bea651e
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-
8
target
=
android-
11
samples/android/tutorial-4-mixed/src/org/opencv/samples/tutorial4/SampleViewBase.java
View file @
5bea651e
...
...
@@ -6,8 +6,10 @@ import java.util.List;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.SurfaceTexture
;
import
android.hardware.Camera
;
import
android.hardware.Camera.PreviewCallback
;
import
android.os.Build
;
import
android.util.Log
;
import
android.view.SurfaceHolder
;
import
android.view.SurfaceView
;
...
...
@@ -59,11 +61,15 @@ public abstract class SampleViewBase extends SurfaceView implements SurfaceHolde
params
.
setPreviewSize
(
getFrameWidth
(),
getFrameHeight
());
mCamera
.
setParameters
(
params
);
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
mCamera
.
setPreviewTexture
(
new
SurfaceTexture
(
10
)
);
}
else
{
try
{
mCamera
.
setPreviewDisplay
(
null
);
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"mCamera.setPreviewDisplay fails: "
+
e
);
}
}
mCamera
.
startPreview
();
}
}
...
...
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