Ask Your Question
0

How to turn on JavaViewCamera

asked 2013-05-20 13:58:37 -0500

Robert Kilar gravatar image

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)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-05-21 11:24:29 -0500

In your first case you try to use OpenCV functionality before library initialization. You may call any OpenCV objects and functions, including object constructors only after OpenCV initialization. When OpenCV is initialized correctly onManagerConnected(LoaderCallbackInterface.SUCCESS) is called.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-05-20 13:58:37 -0500

Seen: 838 times

Last updated: May 21 '13