Code review coments fixed. Lint wornings fixed.

This commit is contained in:
Alexander Smorkalov 2012-10-23 17:00:14 +04:00 committed by Andrey Kamaev
parent 4c06d0834e
commit a942747046
28 changed files with 103 additions and 118 deletions

View File

@ -1,4 +1,4 @@
package org.opencv.framework;
package org.opencv.android;
import java.util.List;
@ -26,7 +26,7 @@ import android.view.SurfaceView;
* The clients shall implement 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;
@ -40,7 +40,7 @@ public abstract class OpenCvCameraBridgeViewBase extends SurfaceView implements
private Bitmap mCacheBitmap;
public OpenCvCameraBridgeViewBase(Context context, AttributeSet attrs) {
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
super(context, attrs);
getHolder().addCallback(this);
mMaxWidth = MAX_UNSPECIFIED;
@ -74,7 +74,7 @@ public abstract class OpenCvCameraBridgeViewBase extends SurfaceView implements
private static final int STOPPED = 0;
private static final int STARTED = 1;
private static final String TAG = "OpenCvCameraBridge";
private static final String TAG = "CameraBridge";
private CvCameraViewListener mListener;
private int mState = STOPPED;

View File

@ -1,4 +1,4 @@
package org.opencv.framework;
package org.opencv.android;
import java.io.IOException;
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
* 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 String TAG = "OpenCvJavaCameraView";
private static final String TAG = "JavaCameraView";
private Mat mBaseMat;
private byte mBuffer[];
@ -55,7 +55,7 @@ public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements
private Camera mCamera;
public OpenCvJavaCameraView(Context context, AttributeSet attrs) {
public JavaCameraView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@ -159,7 +159,7 @@ public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements
/* now we can start update thread */
Log.d(TAG, "Starting processing thread");
mStopThread = false;
mThread = new Thread(new CameraWorker(getWidth(), getHeight()));
mThread = new Thread(new CameraWorker());
mThread.start();
return true;
@ -202,20 +202,11 @@ public class OpenCvJavaCameraView extends OpenCvCameraBridgeViewBase implements
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() {
do {
synchronized (OpenCvJavaCameraView.this) {
synchronized (JavaCameraView.this) {
try {
OpenCvJavaCameraView.this.wait();
JavaCameraView.this.wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@ -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.Size;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.AttributeSet;
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
* 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 Thread mThread;
private VideoCapture mCamera;
public OpenCvNativeCameraView(Context context, AttributeSet attrs) {
public NativeCameraView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void connectCamera(int width, int height) {
protected boolean connectCamera(int width, int height) {
/* 1. We need to instantiate camera
* 2. We need to start thread which will be getting frames
*/
/* First step - initialize camera connection */
initializeCamera(getWidth(), getHeight());
if (!initializeCamera(getWidth(), getHeight()))
return false;
/* now we can start update thread */
mThread = new Thread(new CameraWorker(getWidth(), getHeight()));
mThread = new Thread(new CameraWorker());
mThread.start();
return true;
}
@Override
@ -61,7 +59,6 @@ public class OpenCvNativeCameraView extends OpenCvCameraBridgeViewBase {
/* Now release camera */
releaseCamera();
}
public static class OpenCvSizeAccessor implements ListItemAccessor {
@ -78,51 +75,48 @@ public class OpenCvNativeCameraView extends OpenCvCameraBridgeViewBase {
}
private void initializeCamera(int width, int height) {
private boolean initializeCamera(int width, int height) {
synchronized (this) {
mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
if (mCamera == null)
return false;
//TODO: improve error handling
java.util.List<Size> sizes = mCamera.getSupportedPreviewSizes();
/* Select the size that fits surface considering maximum size allowed */
FrameSize frameSize = calculateCameraFrameSize(sizes, new OpenCvSizeAccessor(), width, height);
Size frameSize = calculateCameraFrameSize(sizes, new OpenCvSizeAccessor(), width, height);
mFrameWidth = (int)frameSize.width;
mFrameHeight = (int)frameSize.height;
double frameWidth = frameSize.width;
double frameHeight = frameSize.height;
AllocateCache();
mCamera.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, frameWidth);
mCamera.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, frameHeight);
mFrameWidth = (int)frameWidth;
mFrameHeight = (int)frameHeight;
mCamera.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, frameSize.width);
mCamera.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, frameSize.height);
}
Log.i(TAG, "Selected camera frame size = (" + mFrameWidth + ", " + mFrameHeight + ")");
return true;
}
private void releaseCamera() {
synchronized (this) {
if (mCamera != null) {
mCamera.release();
}
}
}
private class CameraWorker implements Runnable {
private Mat mRgba = 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() {
Mat modified;
do {
if (!mCamera.grab()) {
Log.e(TAG, "Camera frame grab failed");

View File

@ -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

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/puzzle_activity_surface_view" />

View File

@ -4,8 +4,8 @@ import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Mat;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import android.os.Bundle;
import android.app.Activity;
@ -20,7 +20,7 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
private static final String TAG = "Sample::Puzzle15::Activity";
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private Puzzle15Processor mPuzzle15;
private int mGameWidth;
@ -54,7 +54,7 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
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);
mPuzzle15 = new Puzzle15Processor();
mPuzzle15.prepareNewGame();
@ -98,23 +98,19 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
return true;
}
@Override
public void onCameraViewStarted(int width, int height) {
mGameWidth = width;
mGameHeight = height;
mPuzzle15.prepareGameSize(width, height);
}
@Override
public void onCameraViewStopped() {
}
@Override
public Mat onCameraFrame(Mat inputFrame) {
return mPuzzle15.puzzleFrame(inputFrame);
}
@Override
public boolean onTouch(View view, MotionEvent event) {
int xpos, ypos;

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/color_blob_detection_activity_surface_view" />

View File

@ -12,8 +12,8 @@ import org.opencv.core.MatOfPoint;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import org.opencv.imgproc.Imgproc;
import android.app.Activity;
@ -37,7 +37,7 @@ public class ColorBlobDetectionActivity extends Activity implements OnTouchListe
private Size SPECTRUM_SIZE;
private Scalar CONTOUR_COLOR;
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
@ -71,7 +71,7 @@ public class ColorBlobDetectionActivity extends Activity implements OnTouchListe
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);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/fd_activity_surface_view" />

View File

@ -14,8 +14,8 @@ import org.opencv.core.MatOfRect;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;
@ -53,7 +53,7 @@ public class FdActivity extends Activity implements CvCameraViewListener {
private float mRelativeFaceSize = 0;
private int mAbsoluteFaceSize = 0;
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
@ -125,7 +125,7 @@ public class FdActivity extends Activity implements CvCameraViewListener {
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);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/image_manipulations_activity_surface_view" />

View File

@ -13,8 +13,8 @@ import org.opencv.core.MatOfInt;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.imgproc.Imgproc;
import android.app.Activity;
@ -45,7 +45,7 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
private MenuItem mItemPreviewZoom;
private MenuItem mItemPreviewPixelize;
private MenuItem mItemPreviewPosterize;
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private Size mSize0;
private Size mSizeRgba;
@ -106,7 +106,7 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
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);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry 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>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tutorial1_activity_surface_view" />

View File

@ -4,8 +4,8 @@ import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Mat;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import android.app.Activity;
import android.os.Bundle;
@ -16,7 +16,7 @@ import android.view.WindowManager;
public class Sample1Java extends Activity implements CvCameraViewListener {
private static final String TAG = "OCVSample::Activity";
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
@ -49,7 +49,7 @@ public class Sample1Java extends Activity implements CvCameraViewListener {
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);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.NativeCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tutorial2_activity_surface_view" />

View File

@ -8,8 +8,8 @@ import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.NativeCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;
@ -35,7 +35,7 @@ public class Sample2NativeCamera extends Activity implements CvCameraViewListene
private Mat mRgba;
private Mat mIntermediateMat;
private OpenCvJavaCameraView mOpenCvCameraView;
private NativeCameraView mOpenCvCameraView;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
@ -68,7 +68,7 @@ public class Sample2NativeCamera extends Activity implements CvCameraViewListene
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);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry 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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tutorial4_activity_surface_view" />

View File

@ -5,8 +5,8 @@ import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.imgproc.Imgproc;
import android.app.Activity;
@ -20,7 +20,7 @@ public class Sample3Native extends Activity implements CvCameraViewListener {
private Mat mRgba;
private Mat mGrayMat;
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
@ -57,7 +57,7 @@ public class Sample3Native extends Activity implements CvCameraViewListener {
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);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="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>

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.opencv.framework.OpenCvJavaCameraView
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tutorial4_activity_surface_view" />

View File

@ -5,8 +5,8 @@ import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.framework.OpenCvJavaCameraView;
import org.opencv.framework.OpenCvCameraBridgeViewBase.CvCameraViewListener;
import org.opencv.android.JavaCameraView;
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;
@ -36,7 +36,7 @@ public class Sample4Mixed extends Activity implements CvCameraViewListener {
private MenuItem mItemPreviewCanny;
private MenuItem mItemPreviewFeatures;
private OpenCvJavaCameraView mOpenCvCameraView;
private JavaCameraView mOpenCvCameraView;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
@ -73,7 +73,7 @@ public class Sample4Mixed extends Activity implements CvCameraViewListener {
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);
}