Ask Your Question
0

Wait until OpenCV finished to load

asked 2014-03-19 09:57:51 -0600

KronuZ gravatar image

updated 2014-03-19 09:59:17 -0600

berak gravatar image

How can i wait until OpenCV finished to load in android?? My problem is that i need to do many things with OpenCV, and i need to call methods using OpenCV, when i call those methods, for example to read image, here is the error: 03-19 10:41:09.156: E/AndroidRuntime(6842): java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.highgui.Highgui.imread_1:(Ljava/lang/String;)J

I already called OpenCVLoader.initAsync and the result is true, but seems like when i call the method to read the image, the library does not finished to load. How can i know how, and wait until the library finished to load??? Thks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-03-19 10:05:15 -0600

berak gravatar image

yes, true, it's too early after OpenCVLoader.initAsync

private BaseLoaderCallback  mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
                mOpenCvCameraView.enableView();
                // earliest possible place
                // to put opencv code
                break;
            default:
                super.onManagerConnected(status);
                break;
        }
    }
};

public void onCameraViewStarted(int width, int height) {
    // another safe place for opencv code
}
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-03-19 09:57:51 -0600

Seen: 246 times

Last updated: Mar 19 '14