[opencvjichu]cv::Mat::type() 返回值

南楼画角 提交于 2020-02-15 13:32:48

 

opencv

opencv中Mat存在各种类型,其中mat有一个type()的函数可以返回该Mat的类型。类型表示了矩阵中元素的类型以及矩阵的通道个数,它是一系列的预定义的常量,其命名规则为CV_(位数)+(数据类型)+(通道数)。具体的有以下值: 

 err:

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

Aborted (core dumped)

code:

    cv::Mat rot_tmp;
    rot.convertTo(rot_tmp, CV_32FC1);
    cv::Mat P = (cv::Mat_<float>(3,4) <<
        0, lineL, 0,  0,
        0, 0, -lineL, 0,
        0, 0, 0, -lineL);
    std::cout << "rot.type: " << rot.type()<< std::endl;
    std::cout << "rot_tmp.type: " << rot_tmp.type()<< std::endl;
    std::cout << "P.type: " << P.type()<< std::endl;
    P = rot_tmp.rowRange(0,2)*P;

 

 

cankao 

1.

https://blog.csdn.net/jeffdeen/article/details/52401526

2.

opencv-mat

https://docs.opencv.org/3.1.0/d3/d63/classcv_1_1Mat.html

 

wan

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!