img->cv::Mat-->Base64
std::vector<uchar> buf;
cv::Mat mat(height, width, CV_8U, image_data.data());
cv::imencode(".png", mat, buf);
auto enc_msg = reinterpret_cast<unsigned char *>(buf.data());
msg = Base64::Encode(reinterpret_cast<const char *>(enc_msg), buf.size());
Base64-->cv::Mat-->img
std::string pbStr = Base64::Decode(base64Str);
std::vector<uchar> data(pbStr.begin(), pbStr.end());
cv::Mat img = cv::imdecode(cv::Mat(data), 1);
cv::imwrite("/tmp/qqq.png", img);
标签:Base64,Mat,img,buf,base64,OpenCV,data,cv
From: https://www.cnblogs.com/jiangyibo/p/16843755.html