Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::multiply doesn't work

I tried to multiply matrix, created from a picture, to transposed of this matrix. Transposed matrix created by OpenCv function cv::transpose(). But function cv::multiply doesn't work. I don't know why.

    Mat img = imread( "sample.jpeg", 0 );
    if( img.empty() ) return -1;
    Mat transposed;
    cv::transpose(img, transposed);
    Mat cov;
    cv::multiply(img, transposed, img);

Here is a mistake message: "OpenCV(3.4.1) Error: Sizes of input arguments do not match (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 arithm_op, file /opt/opencv-3.4.1/modules/core/src/arithm.cpp, line 659 terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.1) /opt/opencv-3.4.1/modules/core/src/arithm.cpp:659: 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 arithm_op"

How to fix this error?