问题
@interface FJFaceRecognizer () {
Ptr<FaceRecognizer> _faceClassifier;
}
@property (nonatomic, strong) NSMutableDictionary *labelsDictionary;
@end
@implementation FJFaceRecognizer
- (NSArray *)labels {
On next line I get error message No member named 'getMat' in 'cv::face::FaceRecognizer'
, when using OpenCV 3.0:
cv::Mat labels = _faceClassifier->getMat("labels");
if (labels.total() == 0) {
return @[];
}
else {
NSMutableArray *mutableArray = [NSMutableArray array];
for (MatConstIterator_<int> itr = labels.begin<int>(); itr != labels.end<int>(); ++itr ) {
int lbl = *itr;
[mutableArray addObject:@(lbl)];
}
return [NSArray arrayWithArray:mutableArray];
}
}
}
What should I use instead of getMat
in OpenCV 3.0?
回答1:
If you want std::vector<int>
of labels, you should be able to use getLabelsByString
http://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html
Might be worth looking over the transition guide going from 2 to 3
http://docs.opencv.org/master/db/dfa/tutorial_transition_guide.html
来源:https://stackoverflow.com/questions/28863538/no-member-named-getmat-in-cvfacefacerecognizer