initialize an OpenCV Mat with an 2D array

前端 未结 4 1817
悲哀的现实
悲哀的现实 2020-12-03 03:09

In my application, I want to create a OpenCV Mat A (2-Dimensions) having some values and then pass it to another OpenCV function using A as input.

Currently, I\'m t

4条回答
  •  鱼传尺愫
    2020-12-03 03:42

    In addition to the above answers, there is another option.

    For a smaller data, I would prefer the following:

    Mat A = (Mat_(2, 5) << 1, 2, 3, 4, 5, 7, 8, 9, 10, 11);
    

    You can easily get the desired result without the need to define an additional variable 'data'.

提交回复
热议问题