OpenCV报错:error: (-215:Assertion failed) type == B.type() in function 'gemm'

使用OpenCV做Mat类矩阵运算时发生如下错误:

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.3) /home/wxb/xiazai/opencv-3.4.3/modules/core/src/matmul.cpp:1558: error: (-215:Assertion failed) type == B.type() in function 'gemm'

发生错误的代码段:

    cv::Mat K(3,3,CV_32F);
    E = K.t() * F * K;

错误的原因在于Mat K 的类型CV_32F在运算时与其他矩阵类型不一致,修改为CV_64F即可正常运行。

    cv::Mat K(3,3,CV_64F);

猜你喜欢

转载自blog.csdn.net/qq_33898609/article/details/105723449
今日推荐