I'm trying to perform a simple matrix multiplication using OpenCV from Java but keep getting the following assertion error message:
OpenCV Error: Assertion failed (C.type() == type && (((flags&GEMM_3_T) == 0 && C.rows == d_size.height && C.cols == d_size.width) || ((flags&GEMM_3_T) != 0 && C.rows == d_size.width && C.cols == d_size.height))) in gemm
The following code causes the above error message to be thrown. I'm trying to achieve a very simple matrix multiplication in the form A' x B x C = D
.
Mat A = new Mat(3, 1, CvType.CV_64F);
A.put(0, 0, new double[]{ 1, 2, 3 });
Mat B = new Mat(3, 3, CvType.CV_64F);
B.put(0, 0, new double[]{
1, 2, 3,
4, 5, 6,
7, 8, 9
});
Mat C = new Mat(3, 1, CvType.CV_64F);
C.put(0, 0, new double[]{1, 2, 3});
Mat D = new Mat();
Core.gemm(A.t(), B, 1, C, 1, D);
Please help!