convert static array to cv::Mat (Bug #3429)


Added by mostafa sataki about 11 years ago. Updated about 11 years ago.


Status:Cancelled Start date:2013-12-10
Priority:Normal Due date:
Assignee:mostafa sataki % Done:

0%

Category:core
Target version:-
Affected version:2.4.0 - 2.4.6 Operating System:Windows
Difficulty: HW Platform:x86
Pull request:

Description

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.


History

Updated by Nikita Manovich about 11 years ago

Hi,

Thank you for the bug report. Could you please post here the link to the tutorial and the complete sample?

  • Assignee changed from Vadim Pisarevsky to mostafa sataki
  • Status changed from New to Incomplete

Updated by mostafa sataki about 11 years ago

Hi.
Thank you for response.
tutorial link

Updated by Nikita Manovich about 11 years ago

Hi,

Unfortunetely it doesn't "convert static array to cv::Mat". Second parameter is an array with dimensions.

From the tutorial:
Use C\C++ arrays and initialize via constructor

int sz[3] = {2,2,2};
Mat L(3,sz, CV_8UC(1), Scalar::all(0));
The upper example shows how to create a matrix with more than two dimensions. Specify its dimension, then pass a pointer containing the size for each dimension and the rest remains the same.

I'm going to close the bug. Feel free to reopen it if you think that I'm wrong.

  • Status changed from Incomplete to Cancelled

Also available in: Atom PDF