Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8881409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:20:32+00:00 2026-06-14T20:20:32+00:00

Apple recently added a new constant to the CIDetector class called CIDetectorTracking which appears

  • 0

Apple recently added a new constant to the CIDetector class called CIDetectorTracking which appears to be able to track faces between frames in a video. This would be very beneficial for me if I could manage to figure out how it works..

I’ve tried adding this key to the detectors options dictionary using every object I can think of that is remotely relevant including, my AVCaptureStillImageOutput instance, the UIImage I’m working on, YES, 1, etc.

NSDictionary *detectorOptions = [[NSDictionary alloc] initWithObjectsAndKeys:CIDetectorAccuracyHigh, CIDetectorAccuracy,myAVCaptureStillImageOutput,CIDetectorTracking, nil];

But no matter what parameter I try to pass, it either crashes (obviously I’m guessing at it here) or the debugger outputs:

Unknown CIDetectorTracking specified. Ignoring.

Normally, I wouldn’t be guessing at this, but resources on this topic are virtually nonexistent. Apple’s class reference states:

A key used to enable or disable face tracking for the detector. Use
this option when you want to track faces across frames in a video.

Other than availability being iOS 6+ and OS X 10.8+ that’s it.

Comments inside CIDetector.h:

/*The key in the options dictionary used to specify that feature
tracking should be used. */

If that wasn’t bad enough, a Google search provides 7 results (8 when they find this post) all of which are either Apple class references, API diffs, a SO post asking how to achieve this in iOS 5, or 3rd party copies of the former.

All that being said, any hints or tips for the proper usage of CIDetectorTracking would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:20:33+00:00Added an answer on June 14, 2026 at 8:20 pm

    You’re right, this key is not very well documented. Beside the API docs it is also not explained in:

    • the CIDetector.h header file
    • the Core Image Programming Guide
    • the WWDC 2012 Session “520 – What’s New in Camera Capture”
    • the sample code to this session (StacheCam 2)

    I tried different values for CIDetectorTracking and the only accepted values seem to be @(YES) and @(NO). With other values it prints this message in the console:

    Unknown CIDetectorTracking specified. Ignoring.

    When you set the value to @(YES) you should get tracking id’s with the detected face features.


    However when you want to detect faces in content captured from the camera you should prefer the face detection API in AVFoundation. It has face tracking built in and the face detection happens in the background on the GPU and will be much faster than CoreImage face detection
    It requires iOS 6 and at least an iPhone 4S or iPad 2.

    The face are sent as metadata objects (AVMetadataFaceObject) to the AVCaptureMetadataOutputObjectsDelegate.

    You can use this code (taken from StacheCam 2 and the slides of the WWDC session mentioned above) to setup face detection and get face metadata objects:

    - (void) setupAVFoundationFaceDetection
    {       
        self.metadataOutput = [AVCaptureMetadataOutput new];
        if ( ! [self.session canAddOutput:self.metadataOutput] ) {
            return;
        }
    
        // Metadata processing will be fast, and mostly updating UI which should be done on the main thread
        // So just use the main dispatch queue instead of creating a separate one
        // (compare this to the expensive CoreImage face detection, done on a separate queue)
        [self.metadataOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
        [self.session addOutput:self.metadataOutput];
    
        if ( ! [self.metadataOutput.availableMetadataObjectTypes containsObject:AVMetadataObjectTypeFace] ) {
            // face detection isn't supported (via AV Foundation), fall back to CoreImage
            return;
        }
    
        // We only want faces, if we don't set this we would detect everything available
        // (some objects may be expensive to detect, so best form is to select only what you need)
        self.metadataOutput.metadataObjectTypes = @[ AVMetadataObjectTypeFace ];
    
    }
    
    // AVCaptureMetadataOutputObjectsDelegate
    - (void)captureOutput:(AVCaptureOutput *)captureOutput
             didOutputMetadataObjects:(NSArray *)metadataObjects
             fromConnection:(AVCaptureConnection *)c
    {
       for ( AVMetadataObject *object in metadataObjects ) {
         if ( [[object type] isEqual:AVMetadataObjectTypeFace] ) {
          AVMetadataFaceObject* face = (AVMetadataFaceObject*)object;
          CMTime timestamp = [face time];
          CGRect faceRectangle = [face bounds];
          NSInteger faceID = [face faceID];
          CGFloat rollAngle = [face rollAngle];
          CGFloat yawAngle = [face yawAngle];
          NSNumber* faceID = @(face.faceID); // use this id for tracking
          // Do interesting things with this face
         }
    }
    

    If you want to display the face frames in the preview layer you need to get the transformed face object:

    AVMetadataFaceObject * adjusted = (AVMetadataFaceObject*)[self.previewLayer transformedMetadataObjectForMetadataObject:face];
    

    For details check out the sample code from WWDC 2012.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have A game to which I recently added a global high score functionality
I have noticed recently, when I apply a template to a new HTML website,
Apple.h class Apple { public: Apple(int); static int typeID; private: int id_; }; Apple.cpp
Apple < ActiveRecord:Base Orange < ActiveRecord:Base piece_of_fruit = Apple.new I want to know whether
I recently updated to iPhone SDK 4.0 and are no longer able to build
I have a problem in the game I wrote with XNA. I recently added
Apple has recently changed the portal. Some of the changes are aery good, but
Has Apple been known to recently reject apps that were created in Flash CS5?
I recently started a project, using Apple's Utility Application example project. In the example
In response to Apple's changes in iOS data storage guidelines I recently reconfigured an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.