我正在尝试为iOS应用程序实现dlib的人脸标志检测。 在DLIB的例子,他们初始化shape_predictor这样:如何在Objective-C中使用dlib的shape_predictor?
// And we also need a shape_predictor. This is the tool that will predict face
// landmark positions given an image and face bounding box. Here we are just
// loading the model from the shape_predictor_68_face_landmarks.dat file you gave
// as a command line argument.
shape_predictor sp;
deserialize(argv[1]) >> sp;
我试图做同样的Objective-C和这个地步已经得到了:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"shape_predictor_68_face_landmarks" ofType:@"dat"];
NSData *myData = [NSData dataWithContentsOfFile:filePath];
执行以下操作,给我一个错误的“接收器类型‘DLIB :: shape_predictor’不是一个Objective-C类”
sp = [dlib::shape_predictor deserialize:myData];
dlib库是一个C++库,我不相信你可以直接在iOS中使用,因为iOS使用Objective-C。我认为你需要转换为Objective-C++。我从来没有尝试过,但这些链接可能会有所帮助。 [objective-c-C++-and-objective-C++](http://philjordan.eu/article/mixing-objective-c-c++-and-objective-c++)[Interoperating Between C++ and Objective-C](http: //www.drdobbs.com/cpp/interoperating-between-c-and-objective-c/240165502) –
[面向目标c和dlib的Facelandmarking](https://github.com/shaileshh/Mirror)小型演示项目使用目标C n dlib进行人脸检测。 – Shailesh