1

I am new in OpenCV implementation in Android. I used the following code to find contours.

private void detectEdges(Bitmap bitmap) {
        rgba = new Mat();
        gray = new Mat();
        hierarchy = new Mat();
        Utils.bitmapToMat(bitmap, rgba);

        Imgproc.cvtColor(rgba, gray, Imgproc.COLOR_RGBA2GRAY);
        Imgproc.Canny(gray, gray, 50, 200);

        List<MatOfPoint> contours = new ArrayList<MatOfPoint>();

         // find contours:
        Imgproc.findContours(rgba, contours, hierarchy, Imgproc.RETR_TREE,Imgproc.CHAIN_APPROX_SIMPLE);
        for (int contourIdx = 0; contourIdx < contours.size(); contourIdx++) {
            Imgproc.drawContours(rgba, contours, contourIdx, new Scalar(0, 0, 255), -1);
        }

        Bitmap tempBmp1 = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
                bitmap.getConfig());

        Utils.matToBitmap(gray, tempBmp1);
       ivw.setImageBitmap(tempBmp1);

    }

but app crashes for the error "java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.core.Mat.n_Mat() (tried Java_org_opencv_core_Mat_n_1Mat and Java_org_opencv_core_Mat_n_1Mat__)"

Even I tried to add opencv as async task with this:

  private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
        @Override
        public void onManagerConnected(int status) {
            switch (status) {
                case LoaderCallbackInterface.SUCCESS:
                {
                    Log.i("OpenCV", "OpenCV loaded successfully");

                } break;
                default:
                {
                    super.onManagerConnected(status);
                } break;
            }
        }
    };

but it says that I have to install OpenCV manager, what should I do? Any help will be appreciated!

Sefat Noor Orni
  • 245
  • 1
  • 5
  • 23

1 Answers1

0

After spending around 5 hours, problem solved with this link https://stackoverflow.com/a/35135495/5020679 for OpenCV 3.10

Sefat Noor Orni
  • 245
  • 1
  • 5
  • 23