Opencv Matrix multiplication

后端 未结 1 829
悲哀的现实
悲哀的现实 2021-01-22 13:01

i need to multiply a matrix and its transpose but i get the following error :

\"OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type ==

相关标签:
1条回答
  • 2021-01-22 13:35

    OpenCV only supports matrix multiplication for matrices of floating point real or complex types.

    You are creating matrix of signed integer type.

    Supported types are:

    CV_32FC1 //real float
    CV_32FC2 //complex float
    CV_64FC1 //real double
    CV_64FC2 //complex double
    

    The following similar code will work:

    float dA[] = {
         1,     2,     3,
         4,     5,     6,
         6,     5,     4,
        }; 
    Mat A = Mat(3,3, CV_32F, dA );
    Mat C = A.t()* A;
    
    0 讨论(0)
提交回复
热议问题