Ask Your Question

How to turn on JavaViewCamera

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

Robert Kilar gravatar image

I have added JavaCvCamera to activity xml layout file.

        android:layout_height="fill_parent" />

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

JavaCameraView jcv = (JavaCameraView) findViewById(; 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>(

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) {
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
                Log.i(TAG, "OpenCV loaded successfully");
            } break;
            } 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

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

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

Question Tools


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

Seen: 1,032 times

Last updated: May 21 '13