Home > other >  Dear Daniel, could you tell me how to set the image data (unsigned char *) is stored as a Mat of Ope
Dear Daniel, could you tell me how to set the image data (unsigned char *) is stored as a Mat of Ope

Time:12-29

Existing image data width, height, Imagedata, nChannels, Daniel, help!

CodePudding user response:

Mat YouImg (height, width, CV_8UC3, ImageData),
Or a for loop assignment

CodePudding user response:

Direct copy
 
Unsined char YourData (1024 * 800),
Mat yourMat (800102 4, CV_8UC1);
Memcpy (yourMat the data , YourData, 1024 * 800 * (unsined char));

CodePudding user response:

refer to the second floor u012947309 response:
direct copy
 
Unsined char YourData (1024 * 800),
Mat yourMat (800102 4, CV_8UC1);
Memcpy (yourMat the data , YourData, 1024 * 800 * (unsined char));


The original can't add certain parts of the code color
The last sentence is so
 memcpy (yourMat. Data, YourData, 1024 * 800 * (unsined char)); 

CodePudding user response:

Mat yourMat (800102 4, CV_8UC1); Why is CV_8UC1?

CodePudding user response:

Direct copy for gray image save out there was a problem

CodePudding user response:

reference 5 floor asdf_2012 reply:
Mat yourMat (800102 4, CV_8UC1); Why is CV_8UC1?
8 channel?
  • Related