对于多个面,CIFaceFeature trackingID始终相同

vik*_*kas 2 iphone camera cocoa-touch ios

我想检测项目中的多个面孔.因此,我计划使用CIFaceFure的trackingID属性来保持脸部的轨迹.但我发现,每次面对每一张脸都是一样的.

所以我的问题是,当视频帧中有多个脸部时,如何唯一地识别脸部.我不想识别面部以便以后仅检测当前视频帧.谢谢.

我使用与SqaureCam apple示例项目中相同的代码.在iOS 6中.

for ( CIFaceFeature *face in features ) {
    NSLog(@"face.trackingID %d",face.trackingID);
}
Run Code Online (Sandbox Code Playgroud)

上面的代码为每个面都引用了相同的ID.

Mic*_*lum 8

如果您还没有这样做,则需要确保在检测器的选项中指定CIDetectorTracking的用法.如果我没记错的话,它应该是这样的:

NSDictionary *detectorOptions = @{CIDetectorTracking: @YES};
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
Run Code Online (Sandbox Code Playgroud)