【问题标题】:How to convert the mat image to string (array2d<rgb_pixel>)?如何将 mat 图像转换为字符串(array2d<rgb_pixel>)?
【发布时间】:2015-05-22 05:19:11
【问题描述】:

我为dlib 创建了用于面部标志检测的dll,在opencv 中我们在MAT 中获取图像,但在dlib 中我们使用array2d 获取它,所以有人说如何将mat 转换为array2d ?

完整代码可以查看here

【问题讨论】:

  • 你的标题说转换为字符串,而不是 array2d。

标签: c++ opencv mat dlib


【解决方案1】:

可以尝试使用cv_image,如:

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

// Detect faces 
std::vector<rectangle> faces = detector(image);

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

【讨论】:

    猜你喜欢
    • 2015-05-21
    • 2019-12-26
    • 1970-01-01
    • 2021-01-27
    • 2016-04-27
    • 1970-01-01
    • 1970-01-01
    • 2021-10-02
    • 2015-02-17
    相关资源
    最近更新 更多