【发布时间】:2012-12-04 14:50:12
【问题描述】:
我需要实现一个接收包含图像字节的字符串(通过boost套接字连接接收)并将信息转换到OpenCV的函数cv::Mat.
我还知道图像的宽度和高度以及它的大小(以字节为单位)。我的函数如下所示:
void createImageFromBytes(const std::string& name, std::pair<int,int> dimensions, const std::string& data)
{
int width,height;
width = dimensions.first;
height = dimensions.second;
//convert data to cv::Mat image
std::string filepng = DATA_PATH"/" + name +".png";
imwrite(filepng, image);
}
执行此操作的最佳方法是什么? OpenCV 是否有来自字符串的 Mat 构造函数?
【问题讨论】:
-
这个有什么更新吗?