C++ 如何将mat图像转换为字符串(array2d<;rgb_pixel>;)?

C++ 如何将mat图像转换为字符串(array2d<;rgb_pixel>;)?,c++,opencv,mat,dlib,C++,Opencv,Mat,Dlib,我为人脸地标检测创建了dll,在opencv中,我们在MAT中获取图像,但在dlib中,我们使用array2d获取图像,所以有人说如何将MAT转换为array2d吗 可以查看完整的代码您可以尝试使用,例如: cv::Mat temp; ... cv_image<bgr_pixel> image(temp); // Detect faces std::vector<rectangle> faces = detector(image); cv::Mat temp; ..

我为人脸地标检测创建了dll,在opencv中,我们在MAT中获取图像,但在dlib中,我们使用array2d获取图像,所以有人说如何将MAT转换为array2d吗

可以查看完整的代码

您可以尝试使用,例如:

cv::Mat temp;
...
cv_image<bgr_pixel> image(temp);

// Detect faces 
std::vector<rectangle> faces = detector(image);
cv::Mat temp;
...
cv_图像(温度);
//检测人脸
标准::矢量面=探测器(图像);

还要注意,这只是包装了
cv::Mat
对象,没有复制任何内容。因此,
image
只有在
temp
有效时才有效。这基本上意味着您不应该在使用
image
时修改
temp

您的标题是“转换为字符串”,而不是“转换为数组2d”。