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 settingAVCaptureVideoDataOutput.videoSettings.
-
Create a
PFCameraKitinstance.Declaration
Objective-C
+ (void)createWithModelPath:(NSString *_Nullable)path completion:(nonnull void (^)(PFCameraKit *_Nullable, NSError *_Nullable))completion;Parameters
pathSpecify the path of the model files. If the path is null then the model files are in APP’s main bundle.
completionA completion called when the init operation completes.
-
An object implements
PFCameraKitDelegateprotocol 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 settingAVCaptureVideoDataOutput.videoSettings.Declaration
Objective-C
- (void)sendCameraBuffer:(nonnull CMSampleBufferRef)sampleBuffer;Parameters
sampleBufferThe 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
levelThe 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
parameterThe parameter values to apply.
-
Unavailable. Use
+createWithModelPath:completion:forPFCameraKitobject initializing.Declaration
Objective-C
- (nonnull id)init; -
Unavailable. Use
+createWithModelPath:completionforPFCameraKitobject initializing.Declaration
Objective-C
+ (nonnull instancetype)new;
PFCameraKit Class Reference