FacePlusPlus / MegviiFacepp-iOS-SDK

An iOS wrapper of MegviiFacepp SDK (the mobile SDK).
Apache License 2.0
50 stars 19 forks source link

单张图片检测不到人脸 #12

Open poholo opened 7 years ago

poholo commented 7 years ago

是因为图片编码格式原因吗 ?

poholo commented 7 years ago

DetectOneViewController 类中

` UIImage *image = [UIImage imageNamed:@"IMG_1159.JPG"];

self.detectImage.image = image; 

MGImageData *imageData = [[MGImageData alloc] initWithImage:image];

[self.markManager beginDetectionFrame];

CFTimeInterval start = CACurrentMediaTime();

NSArray *faceArray = [self.markManager detectWithImageData:imageData];

CFTimeInterval end = CACurrentMediaTime();

`

poholo commented 7 years ago

` NSString filePath = [[NSBundle mainBundle] pathForResource:@"psb" ofType:@"JPG"]; UIImage tmImage = [[UIImage alloc] initWithContentsOfFile:filePath]; NSData *tmImageData = UIImagePNGRepresentation(tmImage);

UIImage *image=[UIImage imageWithData:tmImageData];
self.detectImage.image = image;

`

手动自己转一下,取巧的方法