我在使用我正在开发的应用时遇到问题。那里已经存在类似的问题(Core Image face detection broken on 64 bit iOS?),但它没有涵盖我正在寻找的内容。我有一个使用CIDetectorTypeFace的cocos2d应用程序由于以下错误而无法正常工作,
“FaceCore:抛出运行时错误异常:dlopen(/System/Library/PrivateFrameworks/FaceCore.framework/fcl-fc-3.dat,2):找不到合适的图像。找到:/ System / Library / PrivateFrameworks / FaceCore.framework / fcl-fc-3.dat:mach-o,但架构错误“,
在我的64位iPhone 5s上。问题是人脸检测正在使用OpenGL,SpriteKit也在我的带有64位架构的iPhone 5上运行。知道发生了什么吗?
- (void)updateTexture:(CMSampleBufferRef)sampleBuffer
{
imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
uint8_t *baseAddress = (uint8_t *)CVPixelBufferGetBaseAddress(imageBuffer);
width = CVPixelBufferGetWidth(imageBuffer);
height = CVPixelBufferGetHeight(imageBuffer);
if(!textureAtlas_.texture) {
CCTexture2D *texture = [[[CCTexture2D alloc] initWithData:baseAddress
pixelFormat:kCCTexture2DPixelFormat_RGBA8888
pixelsWide:width
pixelsHigh:height
contentSize:CGSizeMake(width,height)
] autorelease];
[self setTexture:texture];
}
glBindTexture(GL_TEXTURE_2D, self.texture.name);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, baseAddress);
if(!isProcessingImage) {
pixelBuffer = (CVPixelBufferRef)CMSampleBufferGetImageBuffer(sampleBuffer);
currentImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
[self performSelectorInBackground:@selector(findFaces) withObject:nil];
}
}
CIDetector设置
NSString *accuracy = CIDetectorAccuracyHigh;
NSDictionary *options = [NSDictionary dictionaryWithObject:accuracy forKey:CIDetectorAccuracy];
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:options];
NSArray *features = [detector featuresInImage:currentImage];
currentImage是我用于面部检测部分的图像。
提前致谢!
答案 0 :(得分:1)
我继续在网上搜索寻找答案。找到一个说明问题将在iOS 7.1中解决。我最近安装了iOS 7.1,现在CIDetector工作正常。
答案 1 :(得分:0)
我已将项目中的体系结构(单击应用程序 - >构建设置)更改为“标准体系结构(包括64位)(armv7,armv7s,arm64)。”然后它可以正常工作。
答案 2 :(得分:0)
已经过测试,它正在使用Xcode 5.1 beta 5。