I'm probably being incredibly stupid here but I'm having trouble doing some basicaly Mat multiplication using OpenCV for Android.
I have two Mat's both of the same type, CV_64F
mat1 has size: 3 rows, 3 cols
mat2 has size: 3 rows, 1 cols
I want to multiply them to give the product mat3 of size 3 rows, 1 cols.
I've tried using:
Mat mat3 = new Mat(3, 1, CvType.CV_64F);
Core.multiply(mat1, mat2, mat3);
But I get an error:
CvException
[org.opencv.core.CvException:/home/andreyk/OpenCV2/trunk/opencv_2.3.1.b2/modules/core/src/arithm.cpp:1253:
error: (-209) The operation is neither 'array op array' (where arrays
have the same size and the same number of channels), nor 'array op
scalar', nor 'scalar op array' in function void cv::arithm_op(const
cv::_InputArray&, const cv::_InputArray&, const cv::_OutputArray&,
const cv::_InputArray&, int, void (*)(const uchar, size_t, const
uchar*, size_t, uchar*, size_t, cv::Size, void*), bool, void*)
What am I doing wrong?
Thanks for any help in advance.
EDIT:
If it helps, the 3x3 matrix mat2 is the result of Imgproc.getPerspectiveTransform and the rest of the code is as follows:
Mat mat1 = new Mat(3, 1, CvType.CV_64F);
mat1.put(0, 0, 2.0);
mat1.put(1, 0, 0.5);
mat1.put(2, 0, 1.0);
Mat mat3 = new Mat(3, 1, CvType.CV_64F);
Core.multiply(mat2, mat1, mat3);