Error convert static array to cv::Mat

asked 2013-12-10 01:57:51 -0600

updated 2013-12-10 02:46:32 -0600

I use this sample form OpenCV tutorial for convert static array to cv::Mat

int a[5] ={1,2,3,4,5};

    Mat L(3,a, CV_32SC(1), Scalar::all(0));
    cout << L;

But the L variable in invalid. What is reason?is it BUG?

edit retag flag offensive close merge delete

Comments

did you mean CV_32SC(1) instead of CV_32SC1(1) ?

what are you trying to achieve ? set up a multidimensional Mat ?

or 2d one with content from an array ?

berak gravatar imageberak ( 2013-12-10 02:35:22 -0600 )edit
1

Thanks.I corrected it. In the OpenCV tutorial on page 130 Use C\C++ arrays and initialize via constructor.One such example is mentioned. After create the L from static array the L variable cols & rows are -1.

Mostafa Sataki gravatar imageMostafa Sataki ( 2013-12-10 02:49:25 -0600 )edit