Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Initialize Mat with type CV_8UC1 from arrayt

Hi guys, i tried to initialize my Mat variable which size is 4 x 6. Here is my code :

int dummy_query_data[38] = { 
        255, 0, 255, 255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255,
        255,0,0,255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255
     };


Mat C = Mat(4,9,CV_8UC1,dummy_query_data);

But when i print it to the console using

cout << "C = "<< endl << " "<< C << endl;

It gives incorrect result

C = 
 [255,   0,   0,   0,   0,   0,   0,   0, 255;
   0,   0,   0, 255,   0,   0,   0, 255,   0;
   0,   0, 255,   0,   0,   0,   0,   0,   0;
   0, 255,   0,   0,   0, 255,   0,   0,   0]

Any solution regarding this ? thanks.

Initialize Mat with type CV_8UC1 from arrayt

Hi guys, i tried to initialize my Mat variable which size is 4 x 6. Here is my code :

int dummy_query_data[38] = { 
        255, 0, 255, 255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255,
        255,0,0,255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255
     };


Mat C = Mat(4,9,CV_8UC1,dummy_query_data);

But when i print it to the console using

cout << "C = "<< endl << " "<< C << endl;

It gives incorrect result

C = 
 [255,   0,   0,   0,   0,   0,   0,   0, 255;
   0,   0,   0, 255,   0,   0,   0, 255,   0;
   0,   0, 255,   0,   0,   0,   0,   0,   0;
   0, 255,   0,   0,   0, 255,   0,   0,   0]

Any solution regarding this ? thanks.

Initialize Mat with type CV_8UC1 from arraytarray

Hi guys, i tried to initialize my Mat variable which size is 4 x 6. Here is my code :

int dummy_query_data[38] = { 
        255, 0, 255, 255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255,
        255,0,0,255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255
     };


Mat C = Mat(4,9,CV_8UC1,dummy_query_data);

But when i print it to the console using

cout << "C = "<< endl << " "<< C << endl;

It gives incorrect result

C = 
 [255,   0,   0,   0,   0,   0,   0,   0, 255;
   0,   0,   0, 255,   0,   0,   0, 255,   0;
   0,   0, 255,   0,   0,   0,   0,   0,   0;
   0, 255,   0,   0,   0, 255,   0,   0,   0]

Any solution regarding this ? thanks.

Initialize Mat with type CV_8UC1 from array

Hi guys, i tried to initialize my Mat variable which size is 4 x 6. 9. Here is my code :

int dummy_query_data[38] = { 
        255, 0, 255, 255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255,
        255,0,0,255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255
     };


Mat C = Mat(4,9,CV_8UC1,dummy_query_data);

But when i print it to the console using

cout << "C = "<< endl << " "<< C << endl;

It gives incorrect result

C = 
 [255,   0,   0,   0,   0,   0,   0,   0, 255;
   0,   0,   0, 255,   0,   0,   0, 255,   0;
   0,   0, 255,   0,   0,   0,   0,   0,   0;
   0, 255,   0,   0,   0, 255,   0,   0,   0]

Any solution regarding this ? thanks.

Initialize Mat with type CV_8UC1 from array

Hi guys, i tried to initialize my Mat variable which size is 4 x 9. Here is my code :

int dummy_query_data[38] dummy_query_data[36] = { 
        255, 0, 255, 255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255,
        255,0,0,255,255,255,0,255,255,
        255,0,0,255,255,255,255,255,255
     };


Mat C = Mat(4,9,CV_8UC1,dummy_query_data);

But when i print it to the console using

cout << "C = "<< endl << " "<< C << endl;

It gives incorrect result

C = 
 [255,   0,   0,   0,   0,   0,   0,   0, 255;
   0,   0,   0, 255,   0,   0,   0, 255,   0;
   0,   0, 255,   0,   0,   0,   0,   0,   0;
   0, 255,   0,   0,   0, 255,   0,   0,   0]

Any solution regarding this ? thanks.