OpenCV matrix multiplication assertion

I get

OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type == CV_64FC1 || type == CV_32FC2 || type == CV_64FC2)) in gemm, file /build/buildd
/opencv-2.4.9+dfsg/modules/core/src/matmul.cpp, line 711
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/buildd/opencv-2.4.9+dfsg/modules/core/src/matmul.cpp:711: error: (-215) type == B.type() && (type == CV_32FC1 || type == CV_64FC1 || type == 
CV_32FC2 || type == CV_64FC2) in function gemm


I would like to know where in the docs mentioned above is matrix multiplication supported exclusively for floating point matrices? I could only find people talking about this on SO, but nothing compares to the standard documentation so far.


source to share

1 answer

You didn't mention the operator you are using, but you can try mat1.mul (mat2), mat1 * mat2, multiply (mat1, mat2, dst), or do:

mat1.convertTo(mat1, CV_32FC1);
mat2.convertTo(mat2, CV_32FC1);


and if necessary:

mat1.convertTo(mat1, CV_8UC1);
mat2.convertTo(mat2, CV_8UC1);




All Articles