How to create empty Mat in OpenCV?

后端 未结 2 1977
孤独总比滥情好
孤独总比滥情好 2021-01-02 02:39

How to create empty Mat in OpenCV? After creation I want to use push_back method to push rows in Mat.

Something like:

Mat M(0,3,CV_32FC1);

2条回答
  •  爱一瞬间的悲伤
    2021-01-02 03:21

    just start with an empty Mat. the 1st push_back will determine type and size.

    Mat big;
    big.push_back(Mat(1,5,CV_64F,3.5));
    big.push_back(Mat(1,5,CV_64F,9.1));
    big.push_back(Mat(1,5,CV_64F,2.7));
    
    [3.5, 3.5, 3.5, 3.5, 3.5;
     9.1, 9.1, 9.1, 9.1, 9.1;
     2.7, 2.7, 2.7, 2.7, 2.7]
    

提交回复
热议问题