Ask Your Question

loleczek's profile - activity

2016-02-06 16:16:24 -0600 received badge  Notable Question (source)
2016-02-06 16:16:24 -0600 received badge  Famous Question (source)
2015-10-30 04:22:35 -0600 received badge  Popular Question (source)
2015-04-01 18:38:40 -0600 received badge  Editor (source)
2015-04-01 18:35:43 -0600 asked a question Two Cameras, Two Listeners, only One OnCameraFrame

New user here. Playing around with the Camera Preview Tutorial I am able to generate a split screen utilizing the FRONT and BACK cameras simultaneously in a Kindle Fire HDX. To do this I implemented two JavaCameraViews:

<org.opencv.android.JavaCameraView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="0.5"
    android:visibility="visible"
    android:id="@+id/tutorial1_activity_java_surface_view"
    opencv:show_fps="true"
    opencv:camera_id="back" />

<org.opencv.android.JavaCameraView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="0.5"
    android:visibility="visible"
    android:id="@+id/tutorial1_activity_native_surface_view"
    opencv:show_fps="true"
    opencast:camera_id="front" />
</LinearLayout>

</framelayout>

And two Listeners:

    mOpenCvCameraView1 = (CameraBridgeViewBase)findViewById
                                           (R.id.tutorial1_activity_java_surface_view);
    mOpenCvCameraView2 (CameraBridgeViewBase)findViewById
                                           (R.id.tutorial1_activity_native_surface_view);

    mOpenCvCameraView1.setVisibility(SurfaceView.VISIBLE);
    mOpenCvCameraView2.setVisibility(SurfaceView.VISIBLE);

    mOpenCvCameraView1.setCvCameraViewListener(this);  //back camera
    mOpenCvCameraView2.setCvCameraViewListener(this);  //front camera

It works. The problem I can't seem to solve is that:

public class Tutorial1Activity extends Activity implements CvCameraViewListener2 { ...}

only implements a single OnCameraFrame method. If I want to process the Mat differently in each of the Cameras I need a way to determine which Listerner called OnCameraFrame. I'm pretty sure they alternate the calls since, for example, if I processed the OnCameraFrame to return a gray image, both the FRONT and BACK views will be gray. If I comment out ONE of the listerners, then that ONE will be RBG and the other will be gray.

Problem: find a way to identify the CvCameraViewListener, or Camera ID, that called OnCameraFrame within the OnCameraFrame method.

Any help would be much appreciated.

2015-04-01 02:46:21 -0600 received badge  Student (source)
2015-03-27 14:46:58 -0600 asked a question AndroidStudio/NDK - finished with non-zero exit value2

Android Studio 1.1.0 NDK = r10d OpenCV4Android 2.4.10

Can't run OpenCV4android Sample#2/mixed processing.

Information:BUILD FAILED Error:Execution failed for task ':openCVTutorial2MixedProcessing:compileDebugNdk'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\MYDATA\android-ndk-r10d\ndk-build.cmd'' finished with non-zero exit value 2

I've added the NDK directory. I've tried the extra empty c file. New to all this so I don't really understand what is going on. Found other threads that question this "exit value 2" error with no real answer.