Added image-manipulations android sample, other samples are updated; added Mat.size method to java API.

This commit is contained in:
Andrey Kamaev 2011-07-18 16:17:07 +00:00
parent 3119af1c72
commit 72541721a1
18 changed files with 463 additions and 58 deletions

View File

@ -47,6 +47,38 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsEmpty
return me->empty();
}
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize
(JNIEnv* env, jclass cls, jlong self)
{
try {
#ifdef DEBUG
LOGD("core::Mat::nSize()");
#endif // DEBUG
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
cv::Size _retval_ = me->size();
jdoubleArray _da_retval_ = env->NewDoubleArray(2);
jdouble _tmp_retval_[4] = {_retval_.width, _retval_.height};
env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
return _da_retval_;
} catch(cv::Exception e) {
#ifdef DEBUG
LOGD("core::Mat::nSize() catched cv::Exception: %s", e.what());
#endif // DEBUG
jclass je = env->FindClass("org/opencv/CvException");
if(!je) je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, e.what());
return 0;
} catch (...) {
#ifdef DEBUG
LOGD("core::Mat::nSize() catched unknown exception (...)");
#endif // DEBUG
jclass je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, "Unknown exception in JNI code {core::n_1mean__JJ()}");
return 0;
}
}
JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsCont
(JNIEnv* env, jclass cls, jlong self)
{

View File

@ -71,6 +71,12 @@ public class Mat {
return nIsEmpty(nativeObj);
}
//javadoc:Mat::size()
public Size Size() {
if(nativeObj == 0) return new Size();
return new Size(nSize(nativeObj));
}
private void checkNull() {
if(nativeObj == 0)
throw new java.lang.UnsupportedOperationException("Native object address is NULL");
@ -334,6 +340,7 @@ public class Mat {
private static native boolean nIsEmpty(long self);
private static native boolean nIsCont(long self);
private static native boolean nIsSubmat(long self);
private static native double[] nSize(long self);
private static native long nSubmat(long self, int rowStart, int rowEnd, int colStart, int colEnd);
private static native long nClone(long self);
private static native int nPutD(long self, int row, int col, int count, double[] data);

View File

@ -0,0 +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="src" path="OpenCV-2.3.1_src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>image-manipulations</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>OpenCV-2.3.1_src</name>
<type>2</type>
<locationURI>_android_OpenCV_2_3_1_df28900a/src</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -0,0 +1,5 @@
#Wed Jun 29 04:36:40 MSD 2011
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

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.samples.imagemanipulations"
android:versionCode="1"
android:versionName="1.0">
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="ImageManipulationsActivity"
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>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</manifest>

View File

@ -0,0 +1,3 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">image-manipulations</string>
</resources>

View File

@ -0,0 +1,71 @@
package org.opencv.samples.imagemanipulations;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
public class ImageManipulationsActivity extends Activity {
private static final String TAG = "Sample::Activity";
public static final int VIEW_MODE_RGBA = 0;
public static final int VIEW_MODE_CANNY = 1;
public static final int VIEW_MODE_SEPIA = 2;
public static final int VIEW_MODE_SOBEL = 3;
public static final int VIEW_MODE_BLUR = 4;
public static final int VIEW_MODE_ZOOM = 5;
private MenuItem mItemPreviewRGBA;
private MenuItem mItemPreviewCanny;
private MenuItem mItemPreviewSepia;
private MenuItem mItemPreviewSobel;
private MenuItem mItemPreviewBlur;
private MenuItem mItemPreviewZoom;
public static int viewMode = VIEW_MODE_RGBA;
public ImageManipulationsActivity() {
Log.i(TAG, "Instantiated new " + this.getClass());
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(new ImageManipulationsView(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Log.i(TAG, "onCreateOptionsMenu");
mItemPreviewRGBA = menu.add("Preview RGBA");
mItemPreviewCanny = menu.add("Canny");
mItemPreviewSepia = menu.add("Sepia");
mItemPreviewSobel = menu.add("Sobel");
mItemPreviewBlur = menu.add("Blur");
mItemPreviewZoom = menu.add("Zoom");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.i(TAG, "Menu Item selected " + item);
if (item == mItemPreviewRGBA)
viewMode = VIEW_MODE_RGBA;
else if (item == mItemPreviewCanny)
viewMode = VIEW_MODE_CANNY;
else if (item == mItemPreviewSepia)
viewMode = VIEW_MODE_SEPIA;
else if (item == mItemPreviewSobel)
viewMode = VIEW_MODE_SOBEL;
else if (item == mItemPreviewBlur)
viewMode = VIEW_MODE_BLUR;
else if (item == mItemPreviewZoom)
viewMode = VIEW_MODE_ZOOM;
return true;
}
}

View File

@ -0,0 +1,154 @@
package org.opencv.samples.imagemanipulations;
import org.opencv.*;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.SurfaceHolder;
class ImageManipulationsView extends SampleCvViewBase {
private Mat mRgba;
private Mat mGray;
private Mat mIntermediateMat;
private Mat mRgbaInnerWindow;
private Mat mGrayInnerWindow;
private Mat mBlurWindow;
private Mat mZoomWindow;
private Mat mZoomCorner;
private Mat mSepiaKernel;
public ImageManipulationsView(Context context) {
super(context);
mSepiaKernel = new Mat(4, 4, CvType.CV_32F);
mSepiaKernel.put(0, 0, /* R */0.189f, 0.769f, 0.393f, 0f);
mSepiaKernel.put(1, 0, /* G */0.168f, 0.686f, 0.349f, 0f);
mSepiaKernel.put(2, 0, /* B */0.131f, 0.534f, 0.272f, 0f);
mSepiaKernel.put(3, 0, /* A */0.000f, 0.000f, 0.000f, 1f);
}
@Override
public void surfaceChanged(SurfaceHolder _holder, int format, int width, int height) {
super.surfaceChanged(_holder, format, width, height);
synchronized (this) {
// initialize Mats before usage
mGray = new Mat();
mRgba = new Mat();
mIntermediateMat = new Mat();
}
}
private void CreateAuxiliaryMats() {
if (mRgba.empty())
return;
int rows = mRgba.rows();
int cols = mRgba.cols();
int left = cols / 8;
int top = rows / 8;
int width = cols * 3 / 4;
int height = rows * 3 / 4;
if (mRgbaInnerWindow == null)
mRgbaInnerWindow = mRgba.submat(top, top + height, left, left + width);
if (mGrayInnerWindow == null && !mGray.empty())
mGrayInnerWindow = mGray.submat(top, top + height, left, left + width);
if (mBlurWindow == null)
mBlurWindow = mRgba.submat(0, rows, cols / 3, cols * 2 / 3);
if (mZoomCorner == null)
mZoomCorner = mRgba.submat(0, rows / 2 - rows / 10, 0, cols / 2 - cols / 10);
if (mZoomWindow == null)
mZoomWindow = mRgba.submat(rows / 2 - 9 * rows / 100, rows / 2 + 9 * rows / 100, cols / 2 - 9 * cols / 100, cols / 2 + 9 * cols / 100);
}
@Override
protected Bitmap processFrame(VideoCapture capture) {
switch (ImageManipulationsActivity.viewMode) {
case ImageManipulationsActivity.VIEW_MODE_RGBA:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
break;
case ImageManipulationsActivity.VIEW_MODE_CANNY:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
if (mRgbaInnerWindow == null || mGrayInnerWindow == null)
CreateAuxiliaryMats();
imgproc.Canny(mGrayInnerWindow, mGrayInnerWindow, 80, 90);
imgproc.cvtColor(mGrayInnerWindow, mRgbaInnerWindow, imgproc.CV_GRAY2BGRA, 4);
break;
case ImageManipulationsActivity.VIEW_MODE_SOBEL:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
if (mRgbaInnerWindow == null || mGrayInnerWindow == null)
CreateAuxiliaryMats();
imgproc.Sobel(mGrayInnerWindow, mIntermediateMat, CvType.CV_8U, 1, 1);
core.convertScaleAbs(mIntermediateMat, mIntermediateMat, 10);
imgproc.cvtColor(mIntermediateMat, mRgbaInnerWindow, imgproc.CV_GRAY2BGRA, 4);
break;
case ImageManipulationsActivity.VIEW_MODE_SEPIA:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
core.transform(mRgba, mRgba, mSepiaKernel);
break;
case ImageManipulationsActivity.VIEW_MODE_BLUR:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
if (mBlurWindow == null)
CreateAuxiliaryMats();
imgproc.blur(mBlurWindow, mBlurWindow, new Size(15, 15));
break;
case ImageManipulationsActivity.VIEW_MODE_ZOOM:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
if (mZoomCorner == null || mZoomWindow == null)
CreateAuxiliaryMats();
imgproc.resize(mZoomWindow, mZoomCorner, mZoomCorner.Size());
Size wsize = mZoomWindow.Size();
core.rectangle(mZoomWindow, new Point(1, 1), new Point(wsize.width - 2, wsize.height - 2), new Scalar(255, 0, 0, 255), 2);
break;
}
Bitmap bmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);
if (android.MatToBitmap(mRgba, bmp))
return bmp;
bmp.recycle();
return null;
}
@Override
public void run() {
super.run();
synchronized (this) {
// Explicitly deallocate Mats
if (mRgba != null)
mRgba.dispose();
if (mGray != null)
mGray.dispose();
if (mIntermediateMat != null)
mIntermediateMat.dispose();
mRgba = null;
mGray = null;
mIntermediateMat = null;
}
}
}

View File

@ -0,0 +1,108 @@
package org.opencv.samples.imagemanipulations;
import java.util.List;
import org.opencv.*;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
public abstract class SampleCvViewBase extends SurfaceView implements SurfaceHolder.Callback, Runnable {
private static final String TAG = "Sample::SurfaceView";
private SurfaceHolder mHolder;
private VideoCapture mCamera;
public SampleCvViewBase(Context context) {
super(context);
mHolder = getHolder();
mHolder.addCallback(this);
Log.i(TAG, "Instantiated new " + this.getClass());
}
public void surfaceChanged(SurfaceHolder _holder, int format, int width, int height) {
Log.i(TAG, "surfaceCreated");
synchronized (this) {
if (mCamera != null && mCamera.isOpened()) {
Log.i(TAG, "before mCamera.getSupportedPreviewSizes()");
List<Size> sizes = mCamera.getSupportedPreviewSizes();
Log.i(TAG, "after mCamera.getSupportedPreviewSizes()");
int mFrameWidth = width;
int mFrameHeight = height;
// selecting optimal camera preview size
{
double minDiff = Double.MAX_VALUE;
for (Size size : sizes) {
if (Math.abs(size.height - height) < minDiff) {
mFrameWidth = (int) size.width;
mFrameHeight = (int) size.height;
minDiff = Math.abs(size.height - height);
}
}
}
mCamera.set(highgui.CV_CAP_PROP_FRAME_WIDTH, mFrameWidth);
mCamera.set(highgui.CV_CAP_PROP_FRAME_HEIGHT, mFrameHeight);
}
}
}
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated");
mCamera = new VideoCapture(highgui.CV_CAP_ANDROID);
if (mCamera.isOpened()) {
(new Thread(this)).start();
} else {
mCamera.release();
mCamera = null;
Log.e(TAG, "Failed to open native camera");
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
Log.i(TAG, "surfaceDestroyed");
if (mCamera != null) {
synchronized (this) {
mCamera.release();
mCamera = null;
}
}
}
protected abstract Bitmap processFrame(VideoCapture capture);
public void run() {
Log.i(TAG, "Starting processing thread");
while (true) {
Bitmap bmp = null;
synchronized (this) {
if (mCamera == null)
break;
if (!mCamera.grab()) {
Log.e(TAG, "mCamera.grab() failed");
break;
}
bmp = processFrame(mCamera);
}
if (bmp != null) {
Canvas canvas = mHolder.lockCanvas();
if (canvas != null) {
canvas.drawBitmap(bmp, (canvas.getWidth() - bmp.getWidth()) / 2, (canvas.getHeight() - bmp.getHeight()) / 2, null);
mHolder.unlockCanvasAndPost(canvas);
}
bmp.recycle();
}
}
Log.i(TAG, "Finishing processing thread");
}
}

View File

@ -13,14 +13,10 @@ public class Sample1Java extends 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;
public static final int VIEW_MODE_SOBEL = 3;
public static final int VIEW_MODE_BLUR = 4;
private MenuItem mItemPreviewRGBA;
private MenuItem mItemPreviewGray;
private MenuItem mItemPreviewCanny;
private MenuItem mItemPreviewSobel;
private MenuItem mItemPreviewBlur;
public static int viewMode = VIEW_MODE_RGBA;
@ -43,8 +39,6 @@ public class Sample1Java extends Activity {
mItemPreviewRGBA = menu.add("Preview RGBA");
mItemPreviewGray = menu.add("Preview GRAY");
mItemPreviewCanny = menu.add("Canny");
mItemPreviewSobel = menu.add("Sobel");
mItemPreviewBlur = menu.add("Blur");
return true;
}
@ -57,10 +51,6 @@ public class Sample1Java extends Activity {
viewMode = VIEW_MODE_GRAY;
else if (item == mItemPreviewCanny)
viewMode = VIEW_MODE_CANNY;
else if (item == mItemPreviewSobel)
viewMode = VIEW_MODE_SOBEL;
else if (item == mItemPreviewBlur)
viewMode = VIEW_MODE_BLUR;
return true;
}
}

View File

@ -46,15 +46,6 @@ class Sample1View extends SampleViewBase {
imgproc.Canny(mGraySubmat, mIntermediateMat, 80, 100);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break;
case Sample1Java.VIEW_MODE_SOBEL:
imgproc.Sobel(mGraySubmat, mIntermediateMat, CvType.CV_8U, 1, 1);
core.convertScaleAbs(mIntermediateMat, mIntermediateMat, 8);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break;
case Sample1Java.VIEW_MODE_BLUR:
imgproc.cvtColor(mYuv, mRgba, imgproc.CV_YUV420i2RGB, 4);
imgproc.blur(mRgba, mRgba, new Size(15, 15));
break;
}
Bitmap bmp = Bitmap.createBitmap(getFrameWidth(), getFrameHeight(), Bitmap.Config.ARGB_8888);

View File

@ -13,14 +13,10 @@ public class Sample2NativeCamera extends 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;
public static final int VIEW_MODE_SOBEL = 3;
public static final int VIEW_MODE_BLUR = 4;
private MenuItem mItemPreviewRGBA;
private MenuItem mItemPreviewGray;
private MenuItem mItemPreviewCanny;
private MenuItem mItemPreviewSobel;
private MenuItem mItemPreviewBlur;
public static int viewMode = VIEW_MODE_RGBA;
@ -43,8 +39,6 @@ public class Sample2NativeCamera extends Activity {
mItemPreviewRGBA = menu.add("Preview RGBA");
mItemPreviewGray = menu.add("Preview GRAY");
mItemPreviewCanny = menu.add("Canny");
mItemPreviewSobel = menu.add("Sobel");
mItemPreviewBlur = menu.add("Blur");
return true;
}
@ -57,10 +51,6 @@ public class Sample2NativeCamera extends Activity {
viewMode = VIEW_MODE_GRAY;
else if (item == mItemPreviewCanny)
viewMode = VIEW_MODE_CANNY;
else if (item == mItemPreviewSobel)
viewMode = VIEW_MODE_SOBEL;
else if (item == mItemPreviewBlur)
viewMode = VIEW_MODE_BLUR;
return true;
}
}

View File

@ -43,16 +43,6 @@ class Sample2View extends SampleCvViewBase {
imgproc.Canny(mGray, mIntermediateMat, 80, 100);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break;
case Sample2NativeCamera.VIEW_MODE_SOBEL:
capture.retrieve(mGray, highgui.CV_CAP_ANDROID_GREY_FRAME);
imgproc.Sobel(mGray, mIntermediateMat, CvType.CV_8U, 1, 1);
core.convertScaleAbs(mIntermediateMat, mIntermediateMat, 8);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break;
case Sample2NativeCamera.VIEW_MODE_BLUR:
capture.retrieve(mRgba, highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
imgproc.blur(mRgba, mRgba, new Size(15, 15));
break;
}
Bitmap bmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);

View File

@ -13,15 +13,11 @@ public class Sample4Mixed extends 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;
public static final int VIEW_MODE_SOBEL = 3;
public static final int VIEW_MODE_BLUR = 4;
public static final int VIEW_MODE_FEATURES = 5;
private MenuItem mItemPreviewRGBA;
private MenuItem mItemPreviewGray;
private MenuItem mItemPreviewCanny;
private MenuItem mItemPreviewSobel;
private MenuItem mItemPreviewBlur;
private MenuItem mItemPreviewFeatures;
public static int viewMode = VIEW_MODE_RGBA;
@ -44,8 +40,6 @@ public class Sample4Mixed extends Activity {
mItemPreviewRGBA = menu.add("Preview RGBA");
mItemPreviewGray = menu.add("Preview GRAY");
mItemPreviewCanny = menu.add("Canny");
mItemPreviewSobel = menu.add("Sobel");
mItemPreviewBlur = menu.add("Blur");
mItemPreviewFeatures = menu.add("Find features");
return true;
}
@ -58,10 +52,6 @@ public class Sample4Mixed extends Activity {
viewMode = VIEW_MODE_GRAY;
else if (item == mItemPreviewCanny)
viewMode = VIEW_MODE_CANNY;
else if (item == mItemPreviewSobel)
viewMode = VIEW_MODE_SOBEL;
else if (item == mItemPreviewBlur)
viewMode = VIEW_MODE_BLUR;
else if (item == mItemPreviewFeatures)
viewMode = VIEW_MODE_FEATURES;
return true;

View File

@ -45,15 +45,6 @@ class Sample4View extends SampleViewBase {
imgproc.Canny(mGraySubmat, mIntermediateMat, 80, 100);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break;
case Sample4Mixed.VIEW_MODE_SOBEL:
imgproc.Sobel(mGraySubmat, mIntermediateMat, CvType.CV_8U, 1, 1);
core.convertScaleAbs(mIntermediateMat, mIntermediateMat, 8);
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.CV_GRAY2BGRA, 4);
break;
case Sample4Mixed.VIEW_MODE_BLUR:
imgproc.cvtColor(mYuv, mRgba, imgproc.CV_YUV420i2RGB, 4);
imgproc.blur(mRgba, mRgba, new Size(15, 15));
break;
case Sample4Mixed.VIEW_MODE_FEATURES:
imgproc.cvtColor(mYuv, mRgba, imgproc.CV_YUV420i2RGB, 4);
FindFeatures(mGraySubmat.getNativeObjAddr(), mRgba.getNativeObjAddr());