Merge pull request #454 from asmorkalov:android_samples_reorganize
@ -1,7 +0,0 @@ |
|||||||
set(sample example-tutorial-1-addopencv) |
|
||||||
|
|
||||||
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET}) |
|
||||||
if(TARGET ${sample}) |
|
||||||
add_dependencies(opencv_android_examples ${sample}) |
|
||||||
endif() |
|
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<projectDescription> |
<projectDescription> |
||||||
<name>OpenCV Tutorial 1 - Add OpenCV</name> |
<name>OpenCV Tutorial 1 - Camera Preview</name> |
||||||
<comment></comment> |
<comment></comment> |
||||||
<projects> |
<projects> |
||||||
</projects> |
</projects> |
@ -1,4 +1,4 @@ |
|||||||
set(sample example-tutorial-2-opencvcamera) |
set(sample example-tutorial-1-camerapreview) |
||||||
|
|
||||||
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET}) |
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET}) |
||||||
if(TARGET ${sample}) |
if(TARGET ${sample}) |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
@ -1,4 +1,4 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<resources> |
<resources> |
||||||
<string name="app_name">OCV T1 Add OpenCV</string> |
<string name="app_name">OCV T1 Preview</string> |
||||||
</resources> |
</resources> |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<projectDescription> |
<projectDescription> |
||||||
<name>OpenCV Tutorial 3 - Add Native OpenCV</name> |
<name>OpenCV Tutorial 2 - Mixed Processing</name> |
||||||
<comment></comment> |
<comment></comment> |
||||||
<projects> |
<projects> |
||||||
</projects> |
</projects> |
@ -1,4 +1,4 @@ |
|||||||
set(sample example-tutorial-3-native) |
set(sample example-tutorial-2-mixedprocessing) |
||||||
|
|
||||||
if(BUILD_FAT_JAVA_LIB) |
if(BUILD_FAT_JAVA_LIB) |
||||||
set(native_deps opencv_java) |
set(native_deps opencv_java) |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
@ -1,4 +1,4 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<resources> |
<resources> |
||||||
<string name="app_name">OCV T2 Use OpenCV Camera</string> |
<string name="app_name">OCV T2 Mixed Processing</string> |
||||||
</resources> |
</resources> |
@ -1,33 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<projectDescription> |
|
||||||
<name>OpenCV Tutorial 2 - Use OpenCV Camera</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> |
|
@ -1,152 +0,0 @@ |
|||||||
package org.opencv.samples.tutorial2; |
|
||||||
|
|
||||||
import org.opencv.android.BaseLoaderCallback; |
|
||||||
import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; |
|
||||||
import org.opencv.android.LoaderCallbackInterface; |
|
||||||
import org.opencv.android.OpenCVLoader; |
|
||||||
import org.opencv.core.Core; |
|
||||||
import org.opencv.core.CvType; |
|
||||||
import org.opencv.core.Mat; |
|
||||||
import org.opencv.core.Point; |
|
||||||
import org.opencv.core.Scalar; |
|
||||||
import org.opencv.android.CameraBridgeViewBase; |
|
||||||
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; |
|
||||||
import org.opencv.imgproc.Imgproc; |
|
||||||
|
|
||||||
import android.app.Activity; |
|
||||||
import android.os.Bundle; |
|
||||||
import android.util.Log; |
|
||||||
import android.view.Menu; |
|
||||||
import android.view.MenuItem; |
|
||||||
import android.view.WindowManager; |
|
||||||
|
|
||||||
public class Sample2NativeCamera extends Activity implements CvCameraViewListener2 { |
|
||||||
private static final String TAG = "OCVSample::Activity"; |
|
||||||
|
|
||||||
public static final int VIEW_MODE_RGBA = 0; |
|
||||||
public static final int VIEW_MODE_GRAY = 1; |
|
||||||
public static final int VIEW_MODE_CANNY = 2; |
|
||||||
|
|
||||||
private static int viewMode = VIEW_MODE_RGBA; |
|
||||||
private MenuItem mItemPreviewRGBA; |
|
||||||
private MenuItem mItemPreviewGray; |
|
||||||
private MenuItem mItemPreviewCanny; |
|
||||||
private Mat mRgba; |
|
||||||
private Mat mIntermediateMat; |
|
||||||
|
|
||||||
private CameraBridgeViewBase mOpenCvCameraView; |
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { |
|
||||||
@Override |
|
||||||
public void onManagerConnected(int status) { |
|
||||||
switch (status) { |
|
||||||
case LoaderCallbackInterface.SUCCESS: |
|
||||||
{ |
|
||||||
Log.i(TAG, "OpenCV loaded successfully"); |
|
||||||
mOpenCvCameraView.enableView(); |
|
||||||
} break; |
|
||||||
default: |
|
||||||
{ |
|
||||||
super.onManagerConnected(status); |
|
||||||
} break; |
|
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
public Sample2NativeCamera() { |
|
||||||
Log.i(TAG, "Instantiated new " + this.getClass()); |
|
||||||
} |
|
||||||
|
|
||||||
/** Called when the activity is first created. */ |
|
||||||
@Override |
|
||||||
public void onCreate(Bundle savedInstanceState) { |
|
||||||
Log.i(TAG, "called onCreate"); |
|
||||||
super.onCreate(savedInstanceState); |
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
||||||
|
|
||||||
setContentView(R.layout.tutorial2_surface_view); |
|
||||||
|
|
||||||
mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view); |
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onPause() |
|
||||||
{ |
|
||||||
super.onPause(); |
|
||||||
if (mOpenCvCameraView != null) |
|
||||||
mOpenCvCameraView.disableView(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onResume() |
|
||||||
{ |
|
||||||
super.onResume(); |
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); |
|
||||||
} |
|
||||||
|
|
||||||
public void onDestroy() { |
|
||||||
super.onDestroy(); |
|
||||||
if (mOpenCvCameraView != null) |
|
||||||
mOpenCvCameraView.disableView(); |
|
||||||
} |
|
||||||
|
|
||||||
public void onCameraViewStarted(int width, int height) { |
|
||||||
mRgba = new Mat(height, width, CvType.CV_8UC4); |
|
||||||
mIntermediateMat = new Mat(height, width, CvType.CV_8UC4); |
|
||||||
} |
|
||||||
|
|
||||||
public void onCameraViewStopped() { |
|
||||||
mRgba.release(); |
|
||||||
mIntermediateMat.release(); |
|
||||||
} |
|
||||||
|
|
||||||
public Mat onCameraFrame(CvCameraViewFrame inputFrame) { |
|
||||||
switch (Sample2NativeCamera.viewMode) { |
|
||||||
case Sample2NativeCamera.VIEW_MODE_GRAY: |
|
||||||
{ |
|
||||||
Imgproc.cvtColor(inputFrame.gray(), mRgba, Imgproc.COLOR_GRAY2RGBA, 4); |
|
||||||
} break; |
|
||||||
case Sample2NativeCamera.VIEW_MODE_RGBA: |
|
||||||
{ |
|
||||||
mRgba = inputFrame.rgba(); |
|
||||||
Core.putText(mRgba, "OpenCV+Android", new Point(10, mRgba.rows() - 10), 3, 1, new Scalar(255, 0, 0, 255), 2); |
|
||||||
} break; |
|
||||||
case Sample2NativeCamera.VIEW_MODE_CANNY: |
|
||||||
{ |
|
||||||
Imgproc.Canny(inputFrame.gray(), mIntermediateMat, 80, 100); |
|
||||||
Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2BGRA, 4); |
|
||||||
} break; |
|
||||||
} |
|
||||||
|
|
||||||
return mRgba; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean onCreateOptionsMenu(Menu menu) { |
|
||||||
Log.i(TAG, "called onCreateOptionsMenu"); |
|
||||||
mItemPreviewRGBA = menu.add("Preview RGBA"); |
|
||||||
mItemPreviewGray = menu.add("Preview GRAY"); |
|
||||||
mItemPreviewCanny = menu.add("Canny"); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean onOptionsItemSelected(MenuItem item) { |
|
||||||
Log.i(TAG, "called onOptionsItemSelected; selected item: " + item); |
|
||||||
if (item == mItemPreviewRGBA) |
|
||||||
{ |
|
||||||
viewMode = VIEW_MODE_RGBA; |
|
||||||
} |
|
||||||
else if (item == mItemPreviewGray) |
|
||||||
{ |
|
||||||
viewMode = VIEW_MODE_GRAY; |
|
||||||
} |
|
||||||
else if (item == mItemPreviewCanny) |
|
||||||
{ |
|
||||||
viewMode = VIEW_MODE_CANNY; |
|
||||||
} |
|
||||||
|
|
||||||
return true; |
|
||||||
} |
|
||||||
} |
|
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<projectDescription> |
<projectDescription> |
||||||
<name>OpenCV Tutorial 5 - Camera Control</name> |
<name>OpenCV Tutorial 3 - Camera Control</name> |
||||||
<comment></comment> |
<comment></comment> |
||||||
<projects> |
<projects> |
||||||
</projects> |
</projects> |
@ -1,4 +1,4 @@ |
|||||||
set(sample example-tutorial-5-cameracontrol) |
set(sample example-tutorial-3-cameracontrol) |
||||||
|
|
||||||
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET}) |
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET}) |
||||||
if(TARGET ${sample}) |
if(TARGET ${sample}) |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
@ -1,4 +1,4 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<resources> |
<resources> |
||||||
<string name="app_name">OCV T5 Camera Control</string> |
<string name="app_name">OCV T3 Camera Control</string> |
||||||
</resources> |
</resources> |
@ -1,8 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<classpath> |
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> |
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> |
|
||||||
<classpathentry kind="src" path="src"/> |
|
||||||
<classpathentry kind="src" path="gen"/> |
|
||||||
<classpathentry kind="output" path="bin/classes"/> |
|
||||||
</classpath> |
|
@ -1,75 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|
||||||
<?fileVersion 4.0.0?> |
|
||||||
|
|
||||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> |
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.settings"> |
|
||||||
<cconfiguration id="0.1851062783"> |
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1851062783" moduleId="org.eclipse.cdt.core.settings" name="Default"> |
|
||||||
<externalSettings/> |
|
||||||
<extensions> |
|
||||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
|
||||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
|
||||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> |
|
||||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
|
||||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
|
||||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> |
|
||||||
</extensions> |
|
||||||
</storageModule> |
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
|
||||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1851062783" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg"> |
|
||||||
<folderInfo id="0.1851062783." name="/" resourcePath=""> |
|
||||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.114738979" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> |
|
||||||
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.114738979.901399641" name=""/> |
|
||||||
<builder autoBuildTarget="" command="${NDKROOT}/ndk-build.cmd" enableAutoBuild="true" enableCleanBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.1153158428" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> |
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.835006420" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> |
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1350943194" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> |
|
||||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1640025837" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> |
|
||||||
</tool> |
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.982773030" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> |
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.332905639" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath"> |
|
||||||
<listOptionValue builtIn="false" value=""${NDKROOT}/platforms/android-9/arch-arm/usr/include""/> |
|
||||||
<listOptionValue builtIn="false" value=""${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include""/> |
|
||||||
<listOptionValue builtIn="false" value=""${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include""/> |
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../sdk/native/jni/include""/> |
|
||||||
</option> |
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1475512260" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"> |
|
||||||
<listOptionValue builtIn="false" value="ANDROID=1"/> |
|
||||||
</option> |
|
||||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1082980466" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> |
|
||||||
</tool> |
|
||||||
<tool id="org.eclipse.cdt.build.core.settings.holder.472513352" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> |
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1490236166" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath"> |
|
||||||
<listOptionValue builtIn="false" value=""${NDKROOT}/platforms/android-9/arch-arm/usr/include""/> |
|
||||||
<listOptionValue builtIn="false" value=""${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include""/> |
|
||||||
<listOptionValue builtIn="false" value=""${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include""/> |
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/../../sdk/native/jni/include""/> |
|
||||||
</option> |
|
||||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.945696849" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols"> |
|
||||||
<listOptionValue builtIn="false" value="ANDROID=1"/> |
|
||||||
</option> |
|
||||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.775624510" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> |
|
||||||
</tool> |
|
||||||
</toolChain> |
|
||||||
</folderInfo> |
|
||||||
<sourceEntries> |
|
||||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="jni"/> |
|
||||||
</sourceEntries> |
|
||||||
</configuration> |
|
||||||
</storageModule> |
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> |
|
||||||
</cconfiguration> |
|
||||||
</storageModule> |
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> |
|
||||||
<project id="OpenCV Tutorial 3 - Add Native OpenCV.null.1740260315" name="OpenCV Tutorial 3 - Add Native OpenCV"/> |
|
||||||
</storageModule> |
|
||||||
<storageModule moduleId="scannerConfiguration"> |
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> |
|
||||||
<scannerConfigBuildInfo instanceId="0.1851062783"> |
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> |
|
||||||
</scannerConfigBuildInfo> |
|
||||||
</storageModule> |
|
||||||
<storageModule moduleId="refreshScope" versionNumber="1"> |
|
||||||
<resource resourceType="PROJECT" workspacePath="/OpenCV Tutorial 3 - Add Native OpenCV"/> |
|
||||||
</storageModule> |
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> |
|
||||||
</cproject> |
|
@ -1,38 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
package="org.opencv.samples.tutorial3" |
|
||||||
android:versionCode="21" |
|
||||||
android:versionName="2.1"> |
|
||||||
|
|
||||||
<application |
|
||||||
android:label="@string/app_name" |
|
||||||
android:icon="@drawable/icon" |
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > |
|
||||||
|
|
||||||
<activity android:name="Sample3Native" |
|
||||||
android:label="@string/app_name" |
|
||||||
android:screenOrientation="landscape" |
|
||||||
android:configChanges="keyboardHidden|orientation"> |
|
||||||
<intent-filter> |
|
||||||
<action android:name="android.intent.action.MAIN" /> |
|
||||||
<category android:name="android.intent.category.LAUNCHER" /> |
|
||||||
</intent-filter> |
|
||||||
</activity> |
|
||||||
</application> |
|
||||||
|
|
||||||
<supports-screens android:resizeable="true" |
|
||||||
android:smallScreens="true" |
|
||||||
android:normalScreens="true" |
|
||||||
android:largeScreens="true" |
|
||||||
android:anyDensity="true" /> |
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" /> |
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA"/> |
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false"/> |
|
||||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/> |
|
||||||
<uses-feature android:name="android.hardware.camera.front" android:required="false"/> |
|
||||||
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/> |
|
||||||
|
|
||||||
</manifest> |
|
@ -1,11 +0,0 @@ |
|||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
|
|
||||||
include $(CLEAR_VARS) |
|
||||||
|
|
||||||
include ../../sdk/native/jni/OpenCV.mk |
|
||||||
|
|
||||||
LOCAL_MODULE := native_sample
|
|
||||||
LOCAL_SRC_FILES := jni_part.cpp
|
|
||||||
LOCAL_LDLIBS += -llog -ldl
|
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY) |
|
@ -1,27 +0,0 @@ |
|||||||
#include <jni.h> |
|
||||||
#include <opencv2/core/core.hpp> |
|
||||||
#include <opencv2/imgproc/imgproc.hpp> |
|
||||||
#include <opencv2/features2d/features2d.hpp> |
|
||||||
#include <vector> |
|
||||||
|
|
||||||
using namespace std; |
|
||||||
using namespace cv; |
|
||||||
|
|
||||||
extern "C" { |
|
||||||
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba); |
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba) |
|
||||||
{ |
|
||||||
Mat& mGr = *(Mat*)addrGray; |
|
||||||
Mat& mRgb = *(Mat*)addrRgba; |
|
||||||
vector<KeyPoint> v; |
|
||||||
|
|
||||||
FastFeatureDetector detector(50); |
|
||||||
detector.detect(mGr, v); |
|
||||||
for( unsigned int i = 0; i < v.size(); i++ ) |
|
||||||
{ |
|
||||||
const KeyPoint& kp = v[i]; |
|
||||||
circle(mRgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(255,0,0,255)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,11 +0,0 @@ |
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
xmlns:tools="http://schemas.android.com/tools" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" > |
|
||||||
|
|
||||||
<org.opencv.android.JavaCameraView |
|
||||||
android:layout_width="fill_parent" |
|
||||||
android:layout_height="fill_parent" |
|
||||||
android:id="@+id/tutorial4_activity_surface_view" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
@ -1,4 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<resources> |
|
||||||
<string name="app_name">OCV T3 Add Native OpenCV</string> |
|
||||||
</resources> |
|
@ -1,102 +0,0 @@ |
|||||||
package org.opencv.samples.tutorial3; |
|
||||||
|
|
||||||
import org.opencv.android.BaseLoaderCallback; |
|
||||||
import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; |
|
||||||
import org.opencv.android.LoaderCallbackInterface; |
|
||||||
import org.opencv.android.OpenCVLoader; |
|
||||||
import org.opencv.core.CvType; |
|
||||||
import org.opencv.core.Mat; |
|
||||||
import org.opencv.android.CameraBridgeViewBase; |
|
||||||
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; |
|
||||||
|
|
||||||
import android.app.Activity; |
|
||||||
import android.os.Bundle; |
|
||||||
import android.util.Log; |
|
||||||
import android.view.WindowManager; |
|
||||||
|
|
||||||
public class Sample3Native extends Activity implements CvCameraViewListener2 { |
|
||||||
private static final String TAG = "OCVSample::Activity"; |
|
||||||
|
|
||||||
private Mat mRgba; |
|
||||||
private Mat mGray; |
|
||||||
private CameraBridgeViewBase mOpenCvCameraView; |
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { |
|
||||||
@Override |
|
||||||
public void onManagerConnected(int status) { |
|
||||||
switch (status) { |
|
||||||
case LoaderCallbackInterface.SUCCESS: |
|
||||||
{ |
|
||||||
Log.i(TAG, "OpenCV loaded successfully"); |
|
||||||
|
|
||||||
// Load native library after(!) OpenCV initialization
|
|
||||||
System.loadLibrary("native_sample"); |
|
||||||
|
|
||||||
mOpenCvCameraView.enableView(); |
|
||||||
} break; |
|
||||||
default: |
|
||||||
{ |
|
||||||
super.onManagerConnected(status); |
|
||||||
} break; |
|
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
public Sample3Native() { |
|
||||||
Log.i(TAG, "Instantiated new " + this.getClass()); |
|
||||||
} |
|
||||||
|
|
||||||
/** Called when the activity is first created. */ |
|
||||||
@Override |
|
||||||
public void onCreate(Bundle savedInstanceState) { |
|
||||||
Log.i(TAG, "called onCreate"); |
|
||||||
super.onCreate(savedInstanceState); |
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
||||||
|
|
||||||
setContentView(R.layout.tutorial3_surface_view); |
|
||||||
|
|
||||||
mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial4_activity_surface_view); |
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onPause() |
|
||||||
{ |
|
||||||
super.onPause(); |
|
||||||
if (mOpenCvCameraView != null) |
|
||||||
mOpenCvCameraView.disableView(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onResume() |
|
||||||
{ |
|
||||||
super.onResume(); |
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); |
|
||||||
} |
|
||||||
|
|
||||||
public void onDestroy() { |
|
||||||
super.onDestroy(); |
|
||||||
if (mOpenCvCameraView != null) |
|
||||||
mOpenCvCameraView.disableView(); |
|
||||||
} |
|
||||||
|
|
||||||
public void onCameraViewStarted(int width, int height) { |
|
||||||
mRgba = new Mat(height, width, CvType.CV_8UC4); |
|
||||||
mGray = new Mat(height, width, CvType.CV_8UC1); |
|
||||||
} |
|
||||||
|
|
||||||
public void onCameraViewStopped() { |
|
||||||
mRgba.release(); |
|
||||||
mGray.release(); |
|
||||||
} |
|
||||||
|
|
||||||
public Mat onCameraFrame(CvCameraViewFrame inputFrame) { |
|
||||||
mRgba = inputFrame.rgba(); |
|
||||||
mGray = inputFrame.gray(); |
|
||||||
FindFeatures(mGray.getNativeObjAddr(), mRgba.getNativeObjAddr()); |
|
||||||
|
|
||||||
return mRgba; |
|
||||||
} |
|
||||||
|
|
||||||
public native void FindFeatures(long matAddrGr, long matAddrRgba); |
|
||||||
} |
|
@ -1,101 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<projectDescription> |
|
||||||
<name>OpenCV Tutorial 4 - Mix Java+Native OpenCV</name> |
|
||||||
<comment></comment> |
|
||||||
<projects> |
|
||||||
</projects> |
|
||||||
<buildSpec> |
|
||||||
<buildCommand> |
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> |
|
||||||
<triggers>auto,full,incremental,</triggers> |
|
||||||
<arguments> |
|
||||||
<dictionary> |
|
||||||
<key>?name?</key> |
|
||||||
<value></value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.append_environment</key> |
|
||||||
<value>true</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key> |
|
||||||
<value></value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.buildArguments</key> |
|
||||||
<value></value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.buildCommand</key> |
|
||||||
<value>${NDKROOT}/ndk-build.cmd</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key> |
|
||||||
<value>clean</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.contents</key> |
|
||||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key> |
|
||||||
<value>true</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key> |
|
||||||
<value>false</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key> |
|
||||||
<value>true</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key> |
|
||||||
<value></value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.stopOnError</key> |
|
||||||
<value>true</value> |
|
||||||
</dictionary> |
|
||||||
<dictionary> |
|
||||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> |
|
||||||
<value>false</value> |
|
||||||
</dictionary> |
|
||||||
</arguments> |
|
||||||
</buildCommand> |
|
||||||
<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> |
|
||||||
<buildCommand> |
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> |
|
||||||
<triggers>full,incremental,</triggers> |
|
||||||
<arguments> |
|
||||||
</arguments> |
|
||||||
</buildCommand> |
|
||||||
</buildSpec> |
|
||||||
<natures> |
|
||||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature> |
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature> |
|
||||||
<nature>org.eclipse.cdt.core.cnature</nature> |
|
||||||
<nature>org.eclipse.cdt.core.ccnature</nature> |
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> |
|
||||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> |
|
||||||
</natures> |
|
||||||
</projectDescription> |
|
@ -1,4 +0,0 @@ |
|||||||
eclipse.preferences.version=1 |
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6 |
|
||||||
org.eclipse.jdt.core.compiler.source=1.6 |
|
@ -1,38 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
package="org.opencv.samples.tutorial4" |
|
||||||
android:versionCode="21" |
|
||||||
android:versionName="2.1"> |
|
||||||
|
|
||||||
<application |
|
||||||
android:label="@string/app_name" |
|
||||||
android:icon="@drawable/icon" |
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > |
|
||||||
|
|
||||||
<activity android:name="Sample4Mixed" |
|
||||||
android:label="@string/app_name" |
|
||||||
android:screenOrientation="landscape" |
|
||||||
android:configChanges="keyboardHidden|orientation"> |
|
||||||
<intent-filter> |
|
||||||
<action android:name="android.intent.action.MAIN" /> |
|
||||||
<category android:name="android.intent.category.LAUNCHER" /> |
|
||||||
</intent-filter> |
|
||||||
</activity> |
|
||||||
</application> |
|
||||||
|
|
||||||
<supports-screens android:resizeable="true" |
|
||||||
android:smallScreens="true" |
|
||||||
android:normalScreens="true" |
|
||||||
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" android:required="false"/> |
|
||||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/> |
|
||||||
<uses-feature android:name="android.hardware.camera.front" android:required="false"/> |
|
||||||
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/> |
|
||||||
|
|
||||||
</manifest> |
|
@ -1,12 +0,0 @@ |
|||||||
set(sample example-tutorial-4-mixed) |
|
||||||
|
|
||||||
if(BUILD_FAT_JAVA_LIB) |
|
||||||
set(native_deps opencv_java) |
|
||||||
else() |
|
||||||
set(native_deps opencv_features2d) |
|
||||||
endif() |
|
||||||
|
|
||||||
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET} NATIVE_DEPS ${native_deps}) |
|
||||||
if(TARGET ${sample}) |
|
||||||
add_dependencies(opencv_android_examples ${sample}) |
|
||||||
endif() |
|
@ -1,4 +0,0 @@ |
|||||||
APP_STL := gnustl_static
|
|
||||||
APP_CPPFLAGS := -frtti -fexceptions
|
|
||||||
APP_ABI := armeabi-v7a
|
|
||||||
APP_PLATFORM := android-8
|
|
Before Width: | Height: | Size: 2.0 KiB |
@ -1,11 +0,0 @@ |
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
xmlns:tools="http://schemas.android.com/tools" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" > |
|
||||||
|
|
||||||
<org.opencv.android.JavaCameraView |
|
||||||
android:layout_width="fill_parent" |
|
||||||
android:layout_height="fill_parent" |
|
||||||
android:id="@+id/tutorial4_activity_surface_view" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
@ -1,4 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<resources> |
|
||||||
<string name="app_name">OCV T4 Mix Java+Native OpenCV</string> |
|
||||||
</resources> |
|
@ -1,8 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<classpath> |
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> |
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> |
|
||||||
<classpathentry kind="src" path="src"/> |
|
||||||
<classpathentry kind="src" path="gen"/> |
|
||||||
<classpathentry kind="output" path="bin/classes"/> |
|
||||||
</classpath> |
|
@ -1,4 +0,0 @@ |
|||||||
eclipse.preferences.version=1 |
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6 |
|
||||||
org.eclipse.jdt.core.compiler.source=1.6 |
|
Before Width: | Height: | Size: 2.0 KiB |