提交 8288cc10 编写于 作者: A Andrey Kamaev

Continued Android samples renaming

上级 b1ed2771
...@@ -3,13 +3,4 @@ ...@@ -3,13 +3,4 @@
package="org.opencv" package="org.opencv"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">
<application android:label="OpenCV-2.3.1">
<activity android:name="OpenCV-2.3.1"
android:label="OpenCV-2.3.1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest> </manifest>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<link> <link>
<name>OpenCV-2.3.1_src</name> <name>OpenCV-2.3.1_src</name>
<type>2</type> <type>2</type>
<locationURI>_android_OpenCV-2_3_1_d2471b5d/src</locationURI> <locationURI>_android_OpenCV_2_3_1_df28900a/src</locationURI>
</link> </link>
</linkedResources> </linkedResources>
</projectDescription> </projectDescription>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>Sample 3 Native Camera</name> <name>Tutorial 1 Basic - 2. Use OpenCV Camera</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
</natures> </natures>
<linkedResources> <linkedResources>
<link> <link>
<name>opencv2.3.1_src</name> <name>OpenCV-2.3.1_src</name>
<type>2</type> <type>2</type>
<locationURI>_android_opencv2_3_1_d2471b5d/src</locationURI> <locationURI>_android_OpenCV_2_3_1_df28900a/src</locationURI>
</link> </link>
</linkedResources> </linkedResources>
</projectDescription> </projectDescription>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.samples.s3" package="org.opencv.samples.tutorial2"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
android:anyDensity="true" /> android:anyDensity="true" />
<application android:label="@string/app_name" android:icon="@drawable/icon"> <application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="Sample3NativeCamera" <activity android:name="Sample2NativeCamera"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation"> android:configChanges="keyboardHidden|orientation">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Sample 3: Native Camera</string> <string name="app_name">Tutorial 1 Basic - 2. Use OpenCV Camera</string>
</resources> </resources>
package org.opencv.samples.s3; package org.opencv.samples.tutorial2;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
...@@ -7,7 +7,7 @@ import android.view.Menu; ...@@ -7,7 +7,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.Window; import android.view.Window;
public class Sample3NativeCamera extends Activity { public class Sample2NativeCamera extends Activity {
private static final String TAG = "Sample::Activity"; private static final String TAG = "Sample::Activity";
public static final int VIEW_MODE_RGBA = 0; public static final int VIEW_MODE_RGBA = 0;
...@@ -24,7 +24,7 @@ public class Sample3NativeCamera extends Activity { ...@@ -24,7 +24,7 @@ public class Sample3NativeCamera extends Activity {
public static int viewMode = VIEW_MODE_RGBA; public static int viewMode = VIEW_MODE_RGBA;
public Sample3NativeCamera() { public Sample2NativeCamera() {
Log.i(TAG, "Instantiated new " + this.getClass()); Log.i(TAG, "Instantiated new " + this.getClass());
} }
...@@ -34,7 +34,7 @@ public class Sample3NativeCamera extends Activity { ...@@ -34,7 +34,7 @@ public class Sample3NativeCamera extends Activity {
Log.i(TAG, "onCreate"); Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(new Sample3View(this)); setContentView(new Sample2View(this));
} }
@Override @Override
......
package org.opencv.samples.s3; package org.opencv.samples.tutorial2;
import org.opencv.*; import org.opencv.*;
...@@ -6,12 +6,12 @@ import android.content.Context; ...@@ -6,12 +6,12 @@ import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
class Sample3View extends SampleViewBase { class Sample2View extends SampleViewBase {
private Mat mRgba; private Mat mRgba;
private Mat mGray; private Mat mGray;
private Mat mIntermediateMat; private Mat mIntermediateMat;
public Sample3View(Context context) { public Sample2View(Context context) {
super(context); super(context);
} }
...@@ -29,27 +29,27 @@ class Sample3View extends SampleViewBase { ...@@ -29,27 +29,27 @@ class Sample3View extends SampleViewBase {
@Override @Override
protected Bitmap processFrame(VideoCapture capture) { protected Bitmap processFrame(VideoCapture capture) {
switch (Sample3NativeCamera.viewMode) { switch (Sample2NativeCamera.viewMode) {
case Sample3NativeCamera.VIEW_MODE_GRAY: case Sample2NativeCamera.VIEW_MODE_GRAY:
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME); capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
imgproc.cvtColor(mGray, mRgba, imgproc.CV_GRAY2RGBA, 4); imgproc.cvtColor(mGray, mRgba, imgproc.CV_GRAY2RGBA, 4);
break; break;
case Sample3NativeCamera.VIEW_MODE_RGBA: case Sample2NativeCamera.VIEW_MODE_RGBA:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA); capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
core.putText(mRgba, "OpenCV + Android", new Point(10, 100), 3/* CV_FONT_HERSHEY_COMPLEX */, 2, new Scalar(255, 0, 0, 255), 3); core.putText(mRgba, "OpenCV + Android", new Point(10, 100), 3/* CV_FONT_HERSHEY_COMPLEX */, 2, new Scalar(255, 0, 0, 255), 3);
break; break;
case Sample3NativeCamera.VIEW_MODE_CANNY: case Sample2NativeCamera.VIEW_MODE_CANNY:
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME); capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
imgproc.Canny(mGray, mIntermediateMat, 80, 100); imgproc.Canny(mGray, mIntermediateMat, 80, 100);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4); imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break; break;
case Sample3NativeCamera.VIEW_MODE_SOBEL: case Sample2NativeCamera.VIEW_MODE_SOBEL:
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME); capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
imgproc.Sobel(mGray, mIntermediateMat, CvType.CV_8U, 1, 1); imgproc.Sobel(mGray, mIntermediateMat, CvType.CV_8U, 1, 1);
core.convertScaleAbs(mIntermediateMat, mIntermediateMat, 8); core.convertScaleAbs(mIntermediateMat, mIntermediateMat, 8);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4); imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break; break;
case Sample3NativeCamera.VIEW_MODE_BLUR: case Sample2NativeCamera.VIEW_MODE_BLUR:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA); capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
imgproc.blur(mRgba, mRgba, new Size(15, 15)); imgproc.blur(mRgba, mRgba, new Size(15, 15));
break; break;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>Sample 2 Native API</name> <name>Tutorial 2 Advanced - 1. Add Native OpenCV</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.samples.s2" package="org.opencv.samples.tutorial3"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
android:anyDensity="true" /> android:anyDensity="true" />
<application android:label="@string/app_name" android:icon="@drawable/icon"> <application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="Sample2Native" <activity android:name="Sample3Native"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation"> android:configChanges="keyboardHidden|orientation">
......
...@@ -8,7 +8,7 @@ using namespace std; ...@@ -8,7 +8,7 @@ using namespace std;
using namespace cv; using namespace cv;
extern "C" { extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_s2_Sample2View_FindFeatures(JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray yuv, jintArray rgba) JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures(JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray yuv, jintArray rgba)
{ {
jbyte* _yuv = env->GetByteArrayElements(yuv, 0); jbyte* _yuv = env->GetByteArrayElements(yuv, 0);
jint* _rgba = env->GetIntArrayElements(rgba, 0); jint* _rgba = env->GetIntArrayElements(rgba, 0);
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Sample 2: Native API</string> <string name="app_name">Tutorial 2 Advanced - 1. Add Native OpenCV</string>
</resources> </resources>
package org.opencv.samples.s2; package org.opencv.samples.tutorial3;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.Window; import android.view.Window;
public class Sample2Native extends Activity { public class Sample3Native extends Activity {
private static final String TAG = "Sample::Activity"; private static final String TAG = "Sample::Activity";
public Sample2Native() { public Sample3Native() {
Log.i(TAG, "Instantiated new " + this.getClass()); Log.i(TAG, "Instantiated new " + this.getClass());
} }
...@@ -18,6 +18,6 @@ public class Sample2Native extends Activity { ...@@ -18,6 +18,6 @@ public class Sample2Native extends Activity {
Log.i(TAG, "onCreate"); Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(new Sample2View(this)); setContentView(new Sample3View(this));
} }
} }
package org.opencv.samples.s2; package org.opencv.samples.tutorial3;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
class Sample2View extends SampleViewBase { class Sample3View extends SampleViewBase {
public Sample2View(Context context) { public Sample3View(Context context) {
super(context); super(context);
} }
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="opencv2.3.1_src"/> <classpathentry kind="src" path="OpenCV-2.3.1_src"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>Sample 4 Mixed</name> <name>Tutorial 2 Advanced - 2. Mix Java\Native OpenCV</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
</natures> </natures>
<linkedResources> <linkedResources>
<link> <link>
<name>opencv2.3.1_src</name> <name>OpenCV-2.3.1_src</name>
<type>2</type> <type>2</type>
<locationURI>_android_opencv2_3_1_d2471b5d/src</locationURI> <locationURI>_android_OpenCV_2_3_1_df28900a/src</locationURI>
</link> </link>
</linkedResources> </linkedResources>
</projectDescription> </projectDescription>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.samples.s4" package="org.opencv.samples.tutorial4"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">
......
...@@ -8,7 +8,7 @@ using namespace std; ...@@ -8,7 +8,7 @@ using namespace std;
using namespace cv; using namespace cv;
extern "C" { extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_s4_Sample4View_FindFeatures(JNIEnv* env, jobject thiz, jlong addrGray, jlong addrRgba) JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial4_Sample4View_FindFeatures(JNIEnv* env, jobject thiz, jlong addrGray, jlong addrRgba)
{ {
Mat* pMatGr=(Mat*)addrGray; Mat* pMatGr=(Mat*)addrGray;
Mat* pMatRgb=(Mat*)addrRgba; Mat* pMatRgb=(Mat*)addrRgba;
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Sample 4: Mixed</string> <string name="app_name">Tutorial 2 Advanced - 2. Mix Java\Native OpenCV</string>
</resources> </resources>
package org.opencv.samples.s4; package org.opencv.samples.tutorial4;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
......
package org.opencv.samples.s4; package org.opencv.samples.tutorial4;
import org.opencv.*; import org.opencv.*;
......
package org.opencv.samples.s4; package org.opencv.samples.tutorial4;
import java.util.List; import java.util.List;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册