Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When you've removed

if (!OpenCVLoader.initAsync(...

code block then nobody calls

mOpenCVCallBack.onManagerConnected()

that creates View class and opens Camera. Add the call

mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS);

to the OnCreate() methods as a quick dirty fix.

BTW, the "OpenCV error: Cannot load info library for OpenCV" message doesn't indicate an error, look at the further log lines to see that "OpenCV libs init was ok!"

When you've removed

if (!OpenCVLoader.initAsync(...

code block then nobody calls

mOpenCVCallBack.onManagerConnected()

that creates View class and opens Camera. Add the call

mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS);

to the OnCreate() methods as a quick dirty fix.

BTW, the "OpenCV error: Cannot load info library for OpenCV" message doesn't indicate an error, look at the further log lines to see that "OpenCV libs init was ok!"

Here is complete diff:

--- OpenCV-2.4.2-android-sdk\samples\tutorial-1-addopencv\src\org\opencv\samples\tutorial1\Sample1Java.java
+++ OpenCV-2.4.2-android-sdk\samples\tutorial-1-addopencv\src\org\opencv\samples\tutorial1\Sample1Java.java.modified
@@ -21,6 +21,11 @@
     private MenuItem            mItemPreviewCanny;
     private Sample1View         mView;

+static {
+    if (!OpenCVLoader.initDebug()) {
+   //TBD!!!
+    }
+}
     private BaseLoaderCallback  mOpenCVCallBack = new BaseLoaderCallback(this) {
        @Override
        public void onManagerConnected(int status) {
@@ -91,10 +96,11 @@
         requestWindowFeature(Window.FEATURE_NO_TITLE);

         Log.i(TAG, "Trying to load OpenCV library");
-        if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mOpenCVCallBack))
+        /*if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mOpenCVCallBack))
         {
            Log.e(TAG, "Cannot connect to OpenCV Manager");
-        }
+        }*/
+   mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS);
     }

     @Override