0

I am trying to use matrix multiplication to perform transformation of image. In order to start the multiplication, I started with this simple thing but it doesnot work. The code looks like this. The eror message is followed by the code.

    Mat mat1 = Mat.ones(4,4, CvType.CV_8U);
    Mat mat2 = Mat.ones(4,4, CvType.CV_8U);
    Mat result = Mat.ones(4,4, CvType.CV_8U);
    Core.gemm(mat1, mat2, 1, Mat.zeros(result.size(), result.type()), 1, result);

E/cv::error(): OpenCV(3.4.3) Error: Assertion failed ((type == (((5) & ((1 << 3) - 1)) + (((1)-1) << 3)) || type == (((6) & ((1 << 3) - 1)) + (((1)-1) << 3)) || type == (((5) & ((1 << 3) - 1)) + (((2)-1) << 3)) || type == (((6) & ((1 << 3) - 1)) + (((2)-1) << 3)))) in void cv::gemm(cv::InputArray, cv::InputArray, double, cv::InputArray, double, cv::OutputArray, int), file /build/3_4_pack-android/opencv/modules/core/src/matmul.cpp, line 1558

Does anyone know what is the error above? Please help me!

Subash Kharel
  • 478
  • 1
  • 3
  • 12

1 Answers1

0

Make sure you have the types mentioned in the documentations. Its in this link: https://docs.rs/opencv/0.19.2/opencv/core/fn.gemm.html

Subash Kharel
  • 478
  • 1
  • 3
  • 12