std::string str;
std::vector<unsigned char> buff;
cv::imencode(".jpg", requestFace, buff);
str.resize(buff.size());
memcpy(&str[0], buff.data(), buff.size());
转载于:https://www.cnblogs.com/cumtchw/p/11414658.html