mirror of
https://github.com/opencv/opencv.git
synced 2024-12-18 19:38:02 +08:00
Code review coments fixed. Lint wornings fixed.
This commit is contained in:
parent
4c06d0834e
commit
a942747046
@ -1,4 +1,4 @@
|
|||||||
package org.opencv.framework;
|
package org.opencv.android;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ import android.view.SurfaceView;
|
|||||||
* The clients shall implement CvCameraViewListener
|
* The clients shall implement CvCameraViewListener
|
||||||
* TODO: add method to control the format in which the frames will be delivered to CvCameraViewListener
|
* TODO: add method to control the format in which the frames will be delivered to CvCameraViewListener
|
||||||
*/
|
*/
|
||||||
public abstract class OpenCvCameraBridgeViewBase extends SurfaceView implements SurfaceHolder.Callback {
|
public abstract class CameraBridgeViewBase extends SurfaceView implements SurfaceHolder.Callback {
|
||||||
|
|
||||||
private static final int MAX_UNSPECIFIED = -1;
|
private static final int MAX_UNSPECIFIED = -1;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public abstract class OpenCvCameraBridgeViewBase extends SurfaceView implements
|
|||||||
|
|
||||||
private Bitmap mCacheBitmap;
|
private Bitmap mCacheBitmap;
|
||||||
|
|
||||||
public OpenCvCameraBridgeViewBase(Context context, AttributeSet attrs) {
|
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
getHolder().addCallback(this);
|
getHolder().addCallback(this);
|
||||||
mMaxWidth = MAX_UNSPECIFIED;
|
mMaxWidth = MAX_UNSPECIFIED;
|
||||||
@ -74,7 +74,7 @@ public abstract class OpenCvCameraBridgeViewBase extends SurfaceView implements
|
|||||||
private static final int STOPPED = 0;
|
private static final int STOPPED = 0;
|
||||||
private static final int STARTED = 1;
|
private static final int STARTED = 1;
|
||||||
|
|
||||||
private static final String TAG = "OpenCvCameraBridge";
|
private static final String TAG = "CameraBridge";
|
||||||
|
|
||||||
private CvCameraViewListener mListener;
|
private CvCameraViewListener mListener;
|
||||||
private int mState = STOPPED;
|
private int mState = STOPPED;
|
@ -1,4 +1,4 @@
|
|||||||
package org.opencv.framework;
|
package org.opencv.android;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -29,10 +29,10 @@ import org.opencv.imgproc.Imgproc;
|
|||||||
* When frame is delivered via callback from Camera - it processed via OpenCV to be
|
* When frame is delivered via callback from Camera - it processed via OpenCV to be
|
||||||
* converted to RGBA32 and then passed to the external callback for modifications if required.
|
* converted to RGBA32 and then passed to the external callback for modifications if required.
|
||||||
*/
|
*/
|
||||||
public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements PreviewCallback {
|
public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallback {
|
||||||
|
|
||||||
private static final int MAGIC_TEXTURE_ID = 10;
|
private static final int MAGIC_TEXTURE_ID = 10;
|
||||||
private static final String TAG = "OpenCvJavaCameraView";
|
private static final String TAG = "JavaCameraView";
|
||||||
|
|
||||||
private Mat mBaseMat;
|
private Mat mBaseMat;
|
||||||
private byte mBuffer[];
|
private byte mBuffer[];
|
||||||
@ -55,7 +55,7 @@ public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements
|
|||||||
|
|
||||||
private Camera mCamera;
|
private Camera mCamera;
|
||||||
|
|
||||||
public OpenCvJavaCameraView(Context context, AttributeSet attrs) {
|
public JavaCameraView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements
|
|||||||
/* now we can start update thread */
|
/* now we can start update thread */
|
||||||
Log.d(TAG, "Starting processing thread");
|
Log.d(TAG, "Starting processing thread");
|
||||||
mStopThread = false;
|
mStopThread = false;
|
||||||
mThread = new Thread(new CameraWorker(getWidth(), getHeight()));
|
mThread = new Thread(new CameraWorker());
|
||||||
mThread.start();
|
mThread.start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -202,20 +202,11 @@ public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements
|
|||||||
|
|
||||||
private class CameraWorker implements Runnable {
|
private class CameraWorker implements Runnable {
|
||||||
|
|
||||||
private Mat mRgba = new Mat();
|
|
||||||
private int mWidth;
|
|
||||||
private int mHeight;
|
|
||||||
|
|
||||||
CameraWorker(int w, int h) {
|
|
||||||
mWidth = w;
|
|
||||||
mHeight = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
do {
|
do {
|
||||||
synchronized (OpenCvJavaCameraView.this) {
|
synchronized (JavaCameraView.this) {
|
||||||
try {
|
try {
|
||||||
OpenCvJavaCameraView.this.wait();
|
JavaCameraView.this.wait();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
@ -1,14 +1,11 @@
|
|||||||
package org.opencv.framework;
|
package org.opencv.android;
|
||||||
|
|
||||||
import org.opencv.android.Utils;
|
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.core.Size;
|
import org.opencv.core.Size;
|
||||||
import org.opencv.highgui.Highgui;
|
import org.opencv.highgui.Highgui;
|
||||||
import org.opencv.highgui.VideoCapture;
|
import org.opencv.highgui.VideoCapture;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -17,31 +14,32 @@ import android.util.Log;
|
|||||||
* Due to the big amount of work done, by the base class this child is only responsible
|
* Due to the big amount of work done, by the base class this child is only responsible
|
||||||
* for creating camera, destroying camera and delivering frames while camera is enabled
|
* for creating camera, destroying camera and delivering frames while camera is enabled
|
||||||
*/
|
*/
|
||||||
public class OpenCvNativeCameraView extends OpenCvCameraBridgeViewBase {
|
public class NativeCameraView extends CameraBridgeViewBase {
|
||||||
|
|
||||||
public static final String TAG = "OpenCvNativeCameraView";
|
public static final String TAG = "NativeCameraView";
|
||||||
private boolean mStopThread;
|
private boolean mStopThread;
|
||||||
private Thread mThread;
|
private Thread mThread;
|
||||||
private VideoCapture mCamera;
|
private VideoCapture mCamera;
|
||||||
|
|
||||||
|
public NativeCameraView(Context context, AttributeSet attrs) {
|
||||||
public OpenCvNativeCameraView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void connectCamera(int width, int height) {
|
protected boolean connectCamera(int width, int height) {
|
||||||
|
|
||||||
/* 1. We need to instantiate camera
|
/* 1. We need to instantiate camera
|
||||||
* 2. We need to start thread which will be getting frames
|
* 2. We need to start thread which will be getting frames
|
||||||
*/
|
*/
|
||||||
/* First step - initialize camera connection */
|
/* First step - initialize camera connection */
|
||||||
initializeCamera(getWidth(), getHeight());
|
if (!initializeCamera(getWidth(), getHeight()))
|
||||||
|
return false;
|
||||||
|
|
||||||
/* now we can start update thread */
|
/* now we can start update thread */
|
||||||
mThread = new Thread(new CameraWorker(getWidth(), getHeight()));
|
mThread = new Thread(new CameraWorker());
|
||||||
mThread.start();
|
mThread.start();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +59,6 @@ public class OpenCvNativeCameraView extends OpenCvCameraBridgeViewBase {
|
|||||||
|
|
||||||
/* Now release camera */
|
/* Now release camera */
|
||||||
releaseCamera();
|
releaseCamera();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class OpenCvSizeAccessor implements ListItemAccessor {
|
public static class OpenCvSizeAccessor implements ListItemAccessor {
|
||||||
@ -78,32 +75,39 @@ public class OpenCvNativeCameraView extends OpenCvCameraBridgeViewBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeCamera(int width, int height) {
|
private boolean initializeCamera(int width, int height) {
|
||||||
mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
synchronized (this) {
|
||||||
//TODO: improve error handling
|
mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
|
|
||||||
java.util.List<Size> sizes = mCamera.getSupportedPreviewSizes();
|
if (mCamera == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Select the size that fits surface considering maximum size allowed */
|
//TODO: improve error handling
|
||||||
FrameSize frameSize = calculateCameraFrameSize(sizes, new OpenCvSizeAccessor(), width, height);
|
|
||||||
|
|
||||||
|
java.util.List<Size> sizes = mCamera.getSupportedPreviewSizes();
|
||||||
|
|
||||||
double frameWidth = frameSize.width;
|
/* Select the size that fits surface considering maximum size allowed */
|
||||||
double frameHeight = frameSize.height;
|
Size frameSize = calculateCameraFrameSize(sizes, new OpenCvSizeAccessor(), width, height);
|
||||||
|
|
||||||
|
mFrameWidth = (int)frameSize.width;
|
||||||
|
mFrameHeight = (int)frameSize.height;
|
||||||
|
|
||||||
mCamera.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, frameWidth);
|
AllocateCache();
|
||||||
mCamera.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, frameHeight);
|
|
||||||
|
|
||||||
mFrameWidth = (int)frameWidth;
|
mCamera.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, frameSize.width);
|
||||||
mFrameHeight = (int)frameHeight;
|
mCamera.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, frameSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
Log.i(TAG, "Selected camera frame size = (" + mFrameWidth + ", " + mFrameHeight + ")");
|
Log.i(TAG, "Selected camera frame size = (" + mFrameWidth + ", " + mFrameHeight + ")");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void releaseCamera() {
|
private void releaseCamera() {
|
||||||
if (mCamera != null) {
|
synchronized (this) {
|
||||||
mCamera.release();
|
if (mCamera != null) {
|
||||||
|
mCamera.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,18 +115,8 @@ public class OpenCvNativeCameraView extends OpenCvCameraBridgeViewBase {
|
|||||||
|
|
||||||
private Mat mRgba = new Mat();
|
private Mat mRgba = new Mat();
|
||||||
private Mat mGray = new Mat();
|
private Mat mGray = new Mat();
|
||||||
private int mWidth;
|
|
||||||
private int mHeight;
|
|
||||||
|
|
||||||
CameraWorker(int w, int h) {
|
|
||||||
mWidth = w;
|
|
||||||
mHeight = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
Mat modified;
|
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!mCamera.grab()) {
|
if (!mCamera.grab()) {
|
||||||
Log.e(TAG, "Camera frame grab failed");
|
Log.e(TAG, "Camera frame grab failed");
|
@ -0,0 +1,4 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.5
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/puzzle_activity_surface_view" />
|
android:id="@+id/puzzle_activity_surface_view" />
|
||||||
|
@ -4,8 +4,8 @@ import org.opencv.android.BaseLoaderCallback;
|
|||||||
import org.opencv.android.LoaderCallbackInterface;
|
import org.opencv.android.LoaderCallbackInterface;
|
||||||
import org.opencv.android.OpenCVLoader;
|
import org.opencv.android.OpenCVLoader;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -20,7 +20,7 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
|
|||||||
|
|
||||||
private static final String TAG = "Sample::Puzzle15::Activity";
|
private static final String TAG = "Sample::Puzzle15::Activity";
|
||||||
|
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
private Puzzle15Processor mPuzzle15;
|
private Puzzle15Processor mPuzzle15;
|
||||||
|
|
||||||
private int mGameWidth;
|
private int mGameWidth;
|
||||||
@ -54,7 +54,7 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
|
|||||||
|
|
||||||
setContentView(R.layout.activity_puzzle15);
|
setContentView(R.layout.activity_puzzle15);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView) findViewById(R.id.puzzle_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView) findViewById(R.id.puzzle_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
mPuzzle15 = new Puzzle15Processor();
|
mPuzzle15 = new Puzzle15Processor();
|
||||||
mPuzzle15.prepareNewGame();
|
mPuzzle15.prepareNewGame();
|
||||||
@ -98,23 +98,19 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCameraViewStarted(int width, int height) {
|
public void onCameraViewStarted(int width, int height) {
|
||||||
mGameWidth = width;
|
mGameWidth = width;
|
||||||
mGameHeight = height;
|
mGameHeight = height;
|
||||||
mPuzzle15.prepareGameSize(width, height);
|
mPuzzle15.prepareGameSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCameraViewStopped() {
|
public void onCameraViewStopped() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Mat onCameraFrame(Mat inputFrame) {
|
public Mat onCameraFrame(Mat inputFrame) {
|
||||||
return mPuzzle15.puzzleFrame(inputFrame);
|
return mPuzzle15.puzzleFrame(inputFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/color_blob_detection_activity_surface_view" />
|
android:id="@+id/color_blob_detection_activity_surface_view" />
|
||||||
|
@ -12,8 +12,8 @@ import org.opencv.core.MatOfPoint;
|
|||||||
import org.opencv.core.Rect;
|
import org.opencv.core.Rect;
|
||||||
import org.opencv.core.Scalar;
|
import org.opencv.core.Scalar;
|
||||||
import org.opencv.core.Size;
|
import org.opencv.core.Size;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -37,7 +37,7 @@ public class ColorBlobDetectionActivity extends Activity implements OnTouchListe
|
|||||||
private Size SPECTRUM_SIZE;
|
private Size SPECTRUM_SIZE;
|
||||||
private Scalar CONTOUR_COLOR;
|
private Scalar CONTOUR_COLOR;
|
||||||
|
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
@ -71,7 +71,7 @@ public class ColorBlobDetectionActivity extends Activity implements OnTouchListe
|
|||||||
|
|
||||||
setContentView(R.layout.color_blob_detection_surface_view);
|
setContentView(R.layout.color_blob_detection_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.color_blob_detection_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView)findViewById(R.id.color_blob_detection_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/fd_activity_surface_view" />
|
android:id="@+id/fd_activity_surface_view" />
|
||||||
|
@ -14,8 +14,8 @@ import org.opencv.core.MatOfRect;
|
|||||||
import org.opencv.core.Rect;
|
import org.opencv.core.Rect;
|
||||||
import org.opencv.core.Scalar;
|
import org.opencv.core.Scalar;
|
||||||
import org.opencv.core.Size;
|
import org.opencv.core.Size;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
import org.opencv.objdetect.CascadeClassifier;
|
import org.opencv.objdetect.CascadeClassifier;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class FdActivity extends Activity implements CvCameraViewListener {
|
|||||||
private float mRelativeFaceSize = 0;
|
private float mRelativeFaceSize = 0;
|
||||||
private int mAbsoluteFaceSize = 0;
|
private int mAbsoluteFaceSize = 0;
|
||||||
|
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
@ -125,7 +125,7 @@ public class FdActivity extends Activity implements CvCameraViewListener {
|
|||||||
|
|
||||||
setContentView(R.layout.face_detect_surface_view);
|
setContentView(R.layout.face_detect_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.fd_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView)findViewById(R.id.fd_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/image_manipulations_activity_surface_view" />
|
android:id="@+id/image_manipulations_activity_surface_view" />
|
||||||
|
@ -13,8 +13,8 @@ import org.opencv.core.MatOfInt;
|
|||||||
import org.opencv.core.Point;
|
import org.opencv.core.Point;
|
||||||
import org.opencv.core.Scalar;
|
import org.opencv.core.Scalar;
|
||||||
import org.opencv.core.Size;
|
import org.opencv.core.Size;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -45,7 +45,7 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
|
|||||||
private MenuItem mItemPreviewZoom;
|
private MenuItem mItemPreviewZoom;
|
||||||
private MenuItem mItemPreviewPixelize;
|
private MenuItem mItemPreviewPixelize;
|
||||||
private MenuItem mItemPreviewPosterize;
|
private MenuItem mItemPreviewPosterize;
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private Size mSize0;
|
private Size mSize0;
|
||||||
private Size mSizeRgba;
|
private Size mSizeRgba;
|
||||||
@ -106,7 +106,7 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
|
|||||||
|
|
||||||
setContentView(R.layout.image_manipulations_surface_view);
|
setContentView(R.layout.image_manipulations_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.image_manipulations_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView)findViewById(R.id.image_manipulations_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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 exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/tutorial1_activity_surface_view" />
|
android:id="@+id/tutorial1_activity_surface_view" />
|
||||||
|
@ -4,8 +4,8 @@ import org.opencv.android.BaseLoaderCallback;
|
|||||||
import org.opencv.android.LoaderCallbackInterface;
|
import org.opencv.android.LoaderCallbackInterface;
|
||||||
import org.opencv.android.OpenCVLoader;
|
import org.opencv.android.OpenCVLoader;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -16,7 +16,7 @@ import android.view.WindowManager;
|
|||||||
public class Sample1Java extends Activity implements CvCameraViewListener {
|
public class Sample1Java extends Activity implements CvCameraViewListener {
|
||||||
private static final String TAG = "OCVSample::Activity";
|
private static final String TAG = "OCVSample::Activity";
|
||||||
|
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +49,7 @@ public class Sample1Java extends Activity implements CvCameraViewListener {
|
|||||||
|
|
||||||
setContentView(R.layout.tutorial1_surface_view);
|
setContentView(R.layout.tutorial1_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.tutorial1_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView)findViewById(R.id.tutorial1_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.NativeCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/tutorial2_activity_surface_view" />
|
android:id="@+id/tutorial2_activity_surface_view" />
|
||||||
|
@ -8,8 +8,8 @@ import org.opencv.core.CvType;
|
|||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.core.Point;
|
import org.opencv.core.Point;
|
||||||
import org.opencv.core.Scalar;
|
import org.opencv.core.Scalar;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.NativeCameraView;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.highgui.Highgui;
|
import org.opencv.highgui.Highgui;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class Sample2NativeCamera extends Activity implements CvCameraViewListene
|
|||||||
private Mat mRgba;
|
private Mat mRgba;
|
||||||
private Mat mIntermediateMat;
|
private Mat mIntermediateMat;
|
||||||
|
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private NativeCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +68,7 @@ public class Sample2NativeCamera extends Activity implements CvCameraViewListene
|
|||||||
|
|
||||||
setContentView(R.layout.tutorial2_surface_view);
|
setContentView(R.layout.tutorial2_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.tutorial2_activity_surface_view);
|
mOpenCvCameraView = (NativeCameraView)findViewById(R.id.tutorial2_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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 exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/tutorial4_activity_surface_view" />
|
android:id="@+id/tutorial4_activity_surface_view" />
|
||||||
|
@ -5,8 +5,8 @@ import org.opencv.android.LoaderCallbackInterface;
|
|||||||
import org.opencv.android.OpenCVLoader;
|
import org.opencv.android.OpenCVLoader;
|
||||||
import org.opencv.core.CvType;
|
import org.opencv.core.CvType;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -20,9 +20,9 @@ public class Sample3Native extends Activity implements CvCameraViewListener {
|
|||||||
|
|
||||||
private Mat mRgba;
|
private Mat mRgba;
|
||||||
private Mat mGrayMat;
|
private Mat mGrayMat;
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
public void onManagerConnected(int status) {
|
public void onManagerConnected(int status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -57,7 +57,7 @@ public class Sample3Native extends Activity implements CvCameraViewListener {
|
|||||||
|
|
||||||
setContentView(R.layout.tutorial3_surface_view);
|
setContentView(R.layout.tutorial3_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.tutorial4_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView)findViewById(R.id.tutorial4_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<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"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<org.opencv.framework.OpenCvJavaCameraView
|
<org.opencv.android.JavaCameraView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/tutorial4_activity_surface_view" />
|
android:id="@+id/tutorial4_activity_surface_view" />
|
||||||
|
@ -5,8 +5,8 @@ import org.opencv.android.LoaderCallbackInterface;
|
|||||||
import org.opencv.android.OpenCVLoader;
|
import org.opencv.android.OpenCVLoader;
|
||||||
import org.opencv.core.CvType;
|
import org.opencv.core.CvType;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.framework.OpenCvJavaCameraView;
|
import org.opencv.android.JavaCameraView;
|
||||||
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
import org.opencv.highgui.Highgui;
|
import org.opencv.highgui.Highgui;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class Sample4Mixed extends Activity implements CvCameraViewListener {
|
|||||||
private MenuItem mItemPreviewCanny;
|
private MenuItem mItemPreviewCanny;
|
||||||
private MenuItem mItemPreviewFeatures;
|
private MenuItem mItemPreviewFeatures;
|
||||||
|
|
||||||
private OpenCvJavaCameraView mOpenCvCameraView;
|
private JavaCameraView mOpenCvCameraView;
|
||||||
|
|
||||||
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
@ -73,7 +73,7 @@ public class Sample4Mixed extends Activity implements CvCameraViewListener {
|
|||||||
|
|
||||||
setContentView(R.layout.tutorial4_surface_view);
|
setContentView(R.layout.tutorial4_surface_view);
|
||||||
|
|
||||||
mOpenCvCameraView = (OpenCvJavaCameraView)findViewById(R.id.tutorial4_activity_surface_view);
|
mOpenCvCameraView = (JavaCameraView)findViewById(R.id.tutorial4_activity_surface_view);
|
||||||
mOpenCvCameraView.setCvCameraViewListener(this);
|
mOpenCvCameraView.setCvCameraViewListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user