为什么在命名空间“ dlib”中没有名为“ cv_image”的模板?

时间:2019-05-12 10:39:29

标签: objective-c xcode10 dlib

我正在尝试使用cv_image将OpenCV图像格式转换为Dlib的图像格式,但是我得到:

  

在命名空间“ dlib”中没有名为“ cv_image”的模板

这是.h文件:

    #import <Foundation/Foundation.h>
    #include <dlib/opencv.h>
    #include <dlib/opencv/cv_image.h>
    #include <opencv2/highgui/highgui.hpp>
    #include <dlib/image_processing/frontal_face_detector.h>
    #include <dlib/image_processing/render_face_detections.h>
    #include <dlib/image_processing.h>
    #include <dlib/gui_widgets.h>

    using namespace dlib;
    using namespace std;
    using namespace cv;

    NS_ASSUME_NONNULL_BEGIN

    @interface dlibObject : NSObject
    -(void) faceDetection: (cv::Mat*) frame;
    @end

    NS_ASSUME_NONNULL_END

这是.mm文件:

    #import "dlibObject.h"

    @implementation dlibObject

    -(void) faceDetection: (cv::Mat*) frame{

        frontal_face_detector detector = get_frontal_face_detector();
        dlib::cv_image<dlib::bgr_pixel> cimg(frame); // here is the error 
        std::vector<dlib::rectangle> faceRects = detector(frame);

        for ( size_t i = 0; i < faceRects.size(); i++ )
        {
            int x1 = faceRects[i].left();
            int y1 = faceRects[i].top();
            int x2 = faceRects[i].right();
            int y2 = faceRects[i].bottom();

        }
    }

    @end

0 个答案:

没有答案