【发布时间】:2016-08-25 18:48:32
【问题描述】:
我正在尝试为 iOS 应用程序实现 dlib 的面部标志检测。 在 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++Interoperating Between C++ and Objective-C
-
Facelandmarking with objective c and dlib 使用 Objective C n dlib 进行人脸检测的小型演示项目。
标签: ios objective-c methods dlib