【发布时间】:2013-12-14 15:27:34
【问题描述】:
我现在正在开发的应用程序有问题。那里已经有一个类似的问题(Core Image face detection broken on 64 bit iOS?),但它没有涵盖我正在寻找的内容。我有一个使用 CIDetectorTypeFace 的 cocos2d 应用程序,由于以下错误而无法正常工作,
“FaceCore: Throwing runtime error exception: dlopen(/System/Library/PrivateFrameworks/FaceCore.framework/fcl-fc-3.dat, 2): 没有找到合适的图像。确实找到了:/System/Library/PrivateFrameworks/ FaceCore.framework/fcl-fc-3.dat: mach-o, but wrong architecture",
在我的 64 位 iPhone 5s 上。问题是人脸检测与 OpenGL 和 SpriteKit 一起工作,也运行在我的 64 位架构的 iPhone 5s 上。知道发生了什么吗?
- (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 是我用于人脸检测部分的图像。
提前致谢!
【问题讨论】:
-
显示
CIDetector内容的代码在哪里?您是如何设置 AV 捕获的,像素格式是什么? -
当您收到错误消息时,发布所有消息。最好的猜测,听起来你正在链接一个不包含 arm64 切片的库。
-
@bbum,是的,没错。但为什么它与我的精灵套件和 opengl 示例一起使用?下次将发布所有错误消息并在明天编辑此消息! Tark,明天可以添加代码,但是 avcapture 和 cidetector 的设置都是 prettt 标准的。感谢两位的回复!
-
@Tark,不知道是否需要为我的 AVCaptureSession 提供设置,但我用于 videoDataOutput 的像素格式是:kCVPixelFormatType_32BGRA。还添加了 CIDetector 设置的代码。再次感谢!
标签: ios iphone objective-c cocos2d-iphone