CIFaceFeature trackingID对于多个面总是相同的 [英] CIFaceFeature trackingID is always coming same for multiple faces
问题描述
我想在我的项目中检测多个面孔。因此,我计划使用CIFaceFure的trackingID属性来保持面部的轨迹。但我发现,每一次它是相同的每一个面孔。
I want to detect multiple faces in my project. Therefore I planned to use the trackingID property of the CIFaceFure to keep the track of the face. But I found that every time it is coming same for every face.
所以我的问题是当视频帧中有多个脸部时,如何唯一地识别脸部。我不想识别面部以后仅用于当前视频帧的检测。谢谢。
So my problem is that how can I identify a face uniquely when multiple face are there in the video frame. I don't want to recognize the face for later purpose only detection for the current video frame. Thanks.
我使用与SqaureCam apple示例项目中相同的代码。在iOS 6中。
I am using the same code as in SqaureCam apple sample project. in iOS 6.
for ( CIFaceFeature *face in features ) {
NSLog(@"face.trackingID %d",face.trackingID);
}
上面的代码为每个面部填写相同的ID。
The above code is priting the same ID for every face.
推荐答案
如果您尚未这样做,您需要确保在检测器的选项中指定CIDetectorTracking的用法。如果我记得正确,它应该看起来像这样:
If you haven't already done so, you need to make sure to specify the usage of CIDetectorTracking in the detector's options. If I remember correctly, it should look something like this:
NSDictionary *detectorOptions = @{CIDetectorTracking: @YES};
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
这篇关于CIFaceFeature trackingID对于多个面总是相同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!