3.2 STSilentLivenessDetector

- (instancetype)initWithDetectionModelPath:(NSString )detectionModelPath alignmentModelPath:(NSString )alignmentModelPath frameSelectorModelPath:(NSString )frameSelectorModelPath antiSpoofingModelPath:(NSString )antiSpoofingModelPath licensePath:(NSString *)licensePath setDelegate:(id <STSilentLivenessDetectorDelegate>)delegate;

Initialization method.

ParameterDescription

detectionModelPath

Path to DETECTION model resource

alignmentModelPath

Path to ALIGNMENT model resource

frameSelectorModelPath

Path to FRAME_SELECTOR model resource

antiSpoofingModelPath

Path to ANTI_SPOOFING model resource

faceQualityModelPath

Path of the FACE_QUALITY model resource, if you don’t need to perform face quality inspection, can pass in nil

licensePath

Path to the license file, SenseID_Liveness_Silent.lic

delegate

Callback delegate

Return valueDescription

Silent liveness detector example

None

- (void)setImageProcessRule:(STSilentLivenessImageProcessRule *)rule;

Set the processing rule for image cropping.

ParameterDescription

rule

The processing rule of image cropping, please refer to STSilentLivenessImageProcessRule

Return valueDescription

None

None

- (void)setBrowOcclusionEnable:(BOOL)enable;

Set whether to perform eyebrow occlusion detection during liveness detection, NO by default.

ParameterDescription

enable

Yes indicates eyebrow detection is turned on and No indicates eyebrow occlusion detection is turned off.

Return valueDescription

None

None

- (void)setBlurryFilterEnable:(BOOL)enable threshold:(float)threshold;

Set whether to perform blurriness detection during liveness detection, NO by default. The threshold is 1.4 by default.

ParameterDescription

enable

Yes indicates blurriness detection is turned on and No indicates blurriness detection is turned off.

threshold

The threshold used to judge the blurriness. The value range is [0,5]. If the detection result score is larger than the threshold, it is considered blur. The default threshold is 1.4. When it is set to 5, it means that the blurriness detection is turned off.

Return valueDescription

None

None

- (void)setIlluminationFilterEnable:(BOOL)enable darkLightThreshold:(float)darkLightThreshold strongLightThreshold:(float)strongLightThreshold;

Set whether to perform brightness detection during liveness detection, NO by default. The dark light threshold is 1.899 by default. The strong light threshold is 4.997 by default.

ParameterDescription

enable

Yes indicates brightness detection (too bright, too dark) is turned on and No indicates brightness detection is turned off.

darkLightThreshold

The threshold used to judge whether it is too dark. The value range is [0,6]. If the detection result score is smaller than the threshold, it is considered too dark. The default threshold is 1.899. When it is set to 0, it means that the dark brightness detection is turned off.

strongLightThreshold

The threshold used to judge whether it is too bright. The value range is [0,6]. If the detection result score is larger than the threshold, it is considered too bright. The default threshold is 4.997. When it is set to 6, it means that the bright brightness detection is turned off.

Return valueDescription

None

None

- (void)setEyeOpenFilterEnable:(BOOL)enable threshold:(float)threshold;

Set whether to perform eye-opening detection during liveness detection, NO by default. The threshold is 0.47 by default.

ParameterDescription

enable

Yes indicates eye-opening detection is turned on and No indicates eye-opening detection is turned off.

threshold

The threshold used to judge the eye-opening. The value range is [0,1]. If the detection result score is larger than the threshold, it is considered eye-opening. The default threshold is 0.47. When it is set to 0, it means that the eye-opening detection is turned off.

Return valueDescription

None

None

- (void)setOcclusionEnable:(BOOL)enable;

Set whether to perform occlusion detection during liveness detection, NO by default.

ParameterDescription

enable

Yes indicates occlusion detection is turned on and No indicates occlusion detection is turned off.

Return valueDescription

None

None

- (void)setHackThreshold:(float)threshold;

Set the threshold for liveness detection. Need to be called before start to take effect, if not set, 0.88 by default.

ParameterDescription

threshold

The threshold for preventing spoofing. The range is [0.0,1.0].

Return valueDescription

None

None

- (void)setDetectTimeout:(NSInteger)duration;

The maximum detection time allowed for each module, the default value is 10s, the unit is in seconds.

ParameterDescription

duration

The maximum detection time allowed for each module. When it is set to 0, no timeout time is set. The default value is 10s and the unit is in seconds.

Return valueDescription

None

None

- (void)setFaceDistanceRateWithFarRate:(CGFloat) farRate closeRate:(CGFloat) closeRate;

Set the judgment conditions for the face distance.

ParameterDescription

farRate

The ratio of face height/width to the short edge of the image. The value can be set between [0.0 - 1.0]. The closer the parameter is to 0, the farther the face is away from the screen. The default value is 0.4. When set to 0, there will be no distance prompt.

closeRate

The ratio of face height/width to the short edge of the image. The value can be set between [0.0 - 1.0]. The closer the parameter is to 1, the closer the face is to the screen. The default value is 0.8. When set to 0, there will be no distance prompt.

Return valueDescription

None

None

- (void)setPassConditionMinDuration:(NSInteger)minDuration minFrames:(NSInteger)minFrames;

Set the pass condition for the Silent liveness detection.

ParameterDescription

minDuration

The minimum pass time required for silence liveness detection. The value can be set between [0 - dDuration]. The default is 3s. It is recommended to set it to at least 1ms. 0 indicats no minimum time limit. If it is set to a negative number, it will be set to 0s.

minFrames

The minimum number of frames for silence liveness detection. The default is 4. 0 indicates no minimum frame limit. If it is set to a negative number, it will be set to 0.

Return valueDescription

None

None

- (void)inputDataWithSampleBuffer:(CMSampleBufferRef)sampleBuffer faceOrientaion:(STIDSilentLivenessFaceOrientaion)faceOrientation imagePrepareRect:(CGRect)imagePrepareRect;

Liveness detector configuration. Input image for detection.

ParameterDescription

sampleBuffer

Image data for each frame

faceOrientation

Face orientation

imagePrepareRect

Frame of alignment frame

Return valueDescription

None

None

- (void)start;

Start the detection.

- (void)stop;

Stop the detection.

- (BOOL)isBrowOcclusionEnable;

Obtain the eyebrow occlusion detection switch status.

ParameterDescription

None

None

Return valueDescription

BOOL

YES indicates occlusion detection is turned on, NO indicates occlusion detection is turned off.

- (BOOL)isBlurryFilterEnable;

Obtain the blurriness detection switch status.

ParameterDescription

None

None

Return valueDescription

BOOL

YES indicates blurriness detection is turned on, NO indicates blurriness detection is turned off.

- (BOOL)isIlluminationFilterEnable;

Obtain the brightness detection switch status.

ParameterDescription

None

None

Return valueDescription

BOOL

YES indicates brightness detection is turned on, NO indicates brightness detection is turned off.

- (BOOL)isEyeOpenFilterEnable;

Obtain the eye opening detection switch status.

ParameterDescription

None

None

Return valueDescription

BOOL

YES indicates brightness detection is turned on, NO indicates brightness detection is turned off.

- (BOOL)isOcclusionEnable;

Obtain the occlusion detection switch status.

ParameterDescription

None

None

Return valueDescription

BOOL

YES indicates occlusion detection is turned on, NO indicates occlusion detection is turned off.

- (CGFloat)hackThreshold;

Obtain the threshold for liveness detection. Need to be called before start to take effect, if not set, 0.88 by default. If the liveness score is higher than the threshold value, it is judged as a living body, and if the score is lower than the threshold value, detection failed will be displayed.

ParameterDescription

None

None

Return valueDescription

CGFloat

The threshold for liveness detection. The return value is -1 when an error occurs or when the call fails.

- (NSInteger)detectTimeout;

Obtain the timeout time.

ParameterDescription

None

None

Return valueDescription

NSInteger

Timeout time

- (NSInteger)passMinDuration;

Obtain the shortest detection time that can pass the liveness detection.

ParameterDescription

None

None

Return valueDescription

NSInteger

Minimum time

- (NSInteger)passMinFrames;

Obtain the minimum number of detection frames that can pass the liveness detection.

ParameterDescription

None

None

Return valueDescription

NSInteger

Minimum number of frames

- (CGFloat)faceFarRate;

Obtain the farthest face distance threshold in the judgment condition.

ParameterDescription

None

None

Return valueDescription

CGFloat

Farthest distance threshold

- (CGFloat)faceCloseRate;

Obtain the closest face distance threshold in the judgment condition.

ParameterDescription

None

None

Return valueDescription

CGFloat

Closest distance threshold

+ (NSString*)sdkVersion;

Obtain the SDK version.

ParameterDescription

None

None

Return valueDescription

SDK version

SDK version

+ (NSString*)libraryVersion;

Obtain the underlying library version.

ParameterDescription

None

None

Return valueDescription

Underlying library version

Underlying library version

Last updated