opencv mat互转byte

时间:2025-03-16 07:28:14
byte * matToBytes(Mat image)
{
   int size = () * ();
   byte * bytes = new byte[size];  // you will have to delete[] that later
   std::memcpy(bytes,,size * sizeof(byte));
}




Mat bytesToMat(byte * bytes,int width,int height)
{
    Mat image = Mat(height,width,CV_8UC3,bytes).clone(); // make a copy
    return image;
}