3.2 STSilentLivenessDetector
- (instancetype)initWithDetectionModelPath:(NSString )detectionModelPath alignmentModelPath:(NSString )alignmentModelPath frameSelectorModelPath:(NSString )frameSelectorModelPath antiSpoofingModelPath:(NSString )antiSpoofingModelPath licensePath:(NSString *)licensePath setDelegate:(id <STSilentLivenessDetectorDelegate>
)delegate;
<STSilentLivenessDetectorDelegate>
)delegate;Initialization method.
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
Silent liveness detector example
None
- (void)setImageProcessRule:(STSilentLivenessImageProcessRule *)rule;
Set the processing rule for image cropping.
rule
The processing rule of image cropping, please refer to STSilentLivenessImageProcessRule
None
None
- (void)setBrowOcclusionEnable:(BOOL)enable;
Set whether to perform eyebrow occlusion detection during liveness detection, NO by default.
enable
Yes indicates eyebrow detection is turned on and No indicates eyebrow occlusion detection is turned off.
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.
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.
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.
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.
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.
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.
None
None
- (void)setOcclusionEnable:(BOOL)enable;
Set whether to perform occlusion detection during liveness detection, NO by default.
enable
Yes indicates occlusion detection is turned on and No indicates occlusion detection is turned off.
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.
threshold
The threshold for preventing spoofing. The range is [0.0,1.0].
None
None
- (void)setDetectTimeout:(NSInteger)duration;
The maximum detection time allowed for each module, the default value is 10s, the unit is in seconds.
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.
None
None
- (void)setFaceDistanceRateWithFarRate:(CGFloat) farRate closeRate:(CGFloat) closeRate;
Set the judgment conditions for the face distance.
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.
None
None
- (void)setPassConditionMinDuration:(NSInteger)minDuration minFrames:(NSInteger)minFrames;
Set the pass condition for the Silent liveness detection.
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.
None
None
- (void)inputDataWithSampleBuffer:(CMSampleBufferRef)sampleBuffer faceOrientaion:(STIDSilentLivenessFaceOrientaion)faceOrientation imagePrepareRect:(CGRect)imagePrepareRect;
Liveness detector configuration. Input image for detection.
sampleBuffer
Image data for each frame
faceOrientation
Face orientation
imagePrepareRect
Frame of alignment frame
None
None
- (void)start;
Start the detection.
- (void)stop;
Stop the detection.
- (BOOL)isBrowOcclusionEnable;
Obtain the eyebrow occlusion detection switch status.
None
None
BOOL
YES indicates occlusion detection is turned on, NO indicates occlusion detection is turned off.
- (BOOL)isBlurryFilterEnable;
Obtain the blurriness detection switch status.
None
None
BOOL
YES indicates blurriness detection is turned on, NO indicates blurriness detection is turned off.
- (BOOL)isIlluminationFilterEnable;
Obtain the brightness detection switch status.
None
None
BOOL
YES indicates brightness detection is turned on, NO indicates brightness detection is turned off.
- (BOOL)isEyeOpenFilterEnable;
Obtain the eye opening detection switch status.
None
None
BOOL
YES indicates brightness detection is turned on, NO indicates brightness detection is turned off.
- (BOOL)isOcclusionEnable;
Obtain the occlusion detection switch status.
None
None
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.
None
None
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.
None
None
NSInteger
Timeout time
- (NSInteger)passMinDuration;
Obtain the shortest detection time that can pass the liveness detection.
None
None
NSInteger
Minimum time
- (NSInteger)passMinFrames;
Obtain the minimum number of detection frames that can pass the liveness detection.
None
None
NSInteger
Minimum number of frames
- (CGFloat)faceFarRate;
Obtain the farthest face distance threshold in the judgment condition.
None
None
CGFloat
Farthest distance threshold
- (CGFloat)faceCloseRate;
Obtain the closest face distance threshold in the judgment condition.
None
None
CGFloat
Closest distance threshold
+ (NSString*)sdkVersion;
Obtain the SDK version.
None
None
SDK version
SDK version
+ (NSString*)libraryVersion;
Obtain the underlying library version.
None
None
Underlying library version
Underlying library version
Last updated