PFCameraKit


@interface PFCameraKit : NSObject

The class performs face analysis.

Initialize a PFCameraKit object with +[PFCameraKit createWithModelPath:completion:]. The object created will not open camera device and rendering view, external camera source is required. Use -sendCameraBuffer: to input camera frames. Receive quality check results from PFCameraKitDelegate. The relaxed level is applied by default when the object is initialized.

Note

the kCVPixelBufferPixelFormatTypeKey must be specified as kCVPixelFormatType_420YpCbCr8BiPlanarFullRange when setting AVCaptureVideoDataOutput.videoSettings.
  • Create a PFCameraKit instance.

    Declaration

    Objective-C

    + (void)createWithModelPath:(NSString *_Nullable)path
                     completion:(nonnull void (^)(PFCameraKit *_Nullable,
                                                  NSError *_Nullable))completion;
    Parameters
    path

    Specify the path of the model files. If the path is null then the model files are in APP’s main bundle.

    completion

    A completion called when the init operation completes.

  • An object implements PFCameraKitDelegate protocol for receiving the quality of preview sent by calling -sendCameraBuffer:.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<PFCameraKitDelegate> _Nullable delegate;
  • Send the external camera’s frame sample buffer in order for the engine to process.

    Note

    the kCVPixelBufferPixelFormatTypeKey must be specified as kCVPixelFormatType_420YpCbCr8BiPlanarFullRange when setting AVCaptureVideoDataOutput.videoSettings.
    Declaration

    Objective-C

    - (void)sendCameraBuffer:(nonnull CMSampleBufferRef)sampleBuffer;
    Parameters
    sampleBuffer

    The sample buffer from external camera source.

  • A callback function to be called when external camera device is opened.

    @Param isFront Specify if the camera position is front.

    Declaration

    Objective-C

    - (void)onCameraOpen:(BOOL)isFront;
  • Set the current camera kit level.

    Calling this method reapplies the preset thresholds for the selected level.

    Declaration

    Objective-C

    - (void)setCameraKitLevel:(PFCameraKitLevel)level;
    Parameters
    level

    The preset camera kit level.

  • Overwrite the current level thresholds with custom values.

    Calling -setCameraKitLevel: again resets the thresholds back to that level’s preset values. This method accepts a built parameter object.

    Declaration

    Objective-C

    - (void)setCameraKitOverwrite:(nonnull PFCameraKitParameter *)parameter;
    Parameters
    parameter

    The parameter values to apply.

  • Unavailable. Use +createWithModelPath:completion: for PFCameraKit object initializing.

    Declaration

    Objective-C

    - (nonnull id)init;
  • Unavailable. Use +createWithModelPath:completion for PFCameraKit object initializing.

    Declaration

    Objective-C

    + (nonnull instancetype)new;