Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to turn on JavaViewCamera

I have added JavaCvCamera to activity xml layout file.

 <org.opencv.android.JavaCameraView
        android:id="@+id/surface_view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

And then wanted to connect a proper object to it and turn it on:

JavaCameraView jcv = (JavaCameraView) findViewById(R.id.surface_view); jcv.enableView(); But the last command is a reason of runtime error.

05-20 20:33:36.905: E/AndroidRuntime(26187): java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.core.Mat.n_Mat:(III)J
05-20 20:33:36.905: E/AndroidRuntime(26187):    at org.opencv.core.Mat.n_Mat(Native Method)
05-20 20:33:36.905: E/AndroidRuntime(26187):    at org.opencv.core.Mat.<init>(Mat.java:471)

I have found out that it can be done by adding to my Activity stub implements CvCameraViewListener and implement added methods and also implement this below. I do not understand what this object is for. I have read documentation.

private BaseLoaderCallback  mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
            {
                Log.i(TAG, "OpenCV loaded successfully");
                mOpenCvCameraView.enableView();
                mOpenCvCameraView.setOnTouchListener(ColorBlobDetectionActivity.this);
            } break;
            default:
            {
                super.onManagerConnected(status);
            } break;
        }
    }
};

Is there easier way to enable JavaViewCamera camera funtionality(of course openCV camera)?