gpt4 book ai didi

ios - 为什么这个数组总是空的?

转载 作者:行者123 更新时间:2023-11-29 13:15:31 25 4
gpt4 key购买 nike

<分区>

我想弄清楚如何从用户的相机胶卷中获取图像并对其运行一些 Core Image 操作(检测面部)。我能够成功地将图像加载到 uiimageview 中,但由于某种原因我无法使用该图像使用核心图像检测面部。有问题的数组是代码的最后一位,这个数组应该包含 CIFaceFeatures,但它总是空着。我试过使用不同的图像,但仍然无法正常工作。有什么想法吗?

-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self dismissViewControllerAnimated:YES completion:nil];
UIImage *image = [info valueForKey:@"UIImagePickerControllerOriginalImage"];
self.facePicture.image = image;

CIImage* image = [CIImage imageWithCGImage:self.facePicture.image.CGImage];

CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil options:[NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy]];

NSArray* features = [detector featuresInImage:image]; //***features array is empty
NSLog(@"array count is %i",features.count); //returns 0
//Code continues with face detection stuff

}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com