iOS SDK

<p><span style="font-size:18px"><a href="https://obs-cn-shanghai.yun.pingan.com/pacloud/PAFaceDETECT_SDK4.3.21_IOS.zip?response-content-disposition=attachment%3Bfilename%3DPAFaceDETECT_SDK4.3.21_IOS.zip">Click to download V4.3.2</a></span></p> <p><strong>Calling convention</strong></p> <p>1) Initialization</p> <pre> <code>@property (nonatomic ,strong) PAFaceDetector *detector; -(PAFaceDetector *)detector{ if (!_detector) { //Initialization detector _detector = [PAFaceDetector initDetectorWithBundleName:@"ACEFaceKit" andSetDelegate:self]; } return _detector; } </code></pre> <p>2) Reset</p> <pre> <code>-(void) reset;</code></pre> <p>3) Data stream monitoring</p> <table> <thead> <tr> <th style="text-align:left">imgBuffer</th> </tr> <tr> <td>AVCaptureOutput&nbsp;Raw data stream</td> </tr> <tr> <td>RGB</td> </tr> </thead> </table> <pre> <code>-(void) detectWithSampleBuffer:(CMSampleBufferRef)sampleBuffer;</code></pre> <p>&nbsp;</p> <p><strong>Follow the agent PAFaceDetectManagerDelegate</strong></p> <p>1) Data information for each frame</p> <table> <thead> <tr> <th style="text-align:left">perFrame</th> </tr> <tr> <td>Each frame corresponds to the frame data</td> </tr> <tr> <td>The information for each frame data is returned after the detection began</td> </tr> </thead> </table> <pre> <code>-(void)onDetectFrame:(PAFaceDetectionFrame *)perFrame;</code></pre> <p>2) Environment and user operation monitoring</p> <table> <thead> <tr> <th style="text-align:left">tipType</th> </tr> <tr> <td>Current living detection environment and user operation monitoring</td> </tr> <tr> <td>Return the inappropriate places of environment and user operation</td> </tr> </thead> </table> <pre> <code>-(void)onDetectTip:(EnvironmentalTip)tipType;</code></pre> <p>3) Successful motion detection</p> <table> <thead> <tr> <th style="text-align:left">validFrame</th> <th style="text-align:left">currentState</th> </tr> <tr> <td>The current action valid frame</td> <td>&nbsp;Action type</td> </tr> <tr> <td>The best quality frames captured in the current action</td> <td>Current action type</td> </tr> </thead> </table> <pre> <code>-(void)onDetectSuccess:(PAFaceDetectionFrame *)validFrame currentFaceDetectionState:(MotionType)currentState;</code></pre> <p>&nbsp;</p> <p><strong>Appendix</strong></p> <p>PAFaceBasicInfo</p> <pre> <code>/** * Face recognition parameters */ struct PAFaceAttr{ /** Face position */ CGRect face_rect; /** Left-right rotation Angle */ float yaw ; /** Up and down rotation Angle */ float pitch ; /** The degree of motion blur */ float blurness_motion ; /** Brightness */ float brightness ; /** Living result **/ float liveType ; };</code></pre> <p>EnvironmentalTip</p> <pre> <code>typedef NS_ENUM (NSInteger,EnvironmentalTip) { EnvironmentalTip_NORMAL = 2001, //Normal EnvironmentalTip_NO_FACE , //No face EnvironmentalTip_MULTI_FACE , //Multiface EnvironmentalTip_YAW_LEFT, //The face is too left EnvironmentalTip_YAW_RIGHT, //The face is too right EnvironmentalTip_PITCH_UP, //The face is too high EnvironmentalTip_PITCH_DOWN, //The face is too low EnvironmentalTip_ROLL_LEFT, //Please don't tilt your head to the left EnvironmentalTip_ROLL_RIGHT, //Please don't tilt your head to the right EnvironmentalTip_TOO_DARK , //The face is too dark EnvironmentalTip_TOO_BRIGHT , //The face is too bright EnvironmentalTip_TOO_FUZZY , //The face is too fuzzy EnvironmentalTip_TOO_CLOSE, //The face is too close EnvironmentalTip_TOO_FAR , //The face is too far EnvironmentalTip_ILLEGAL, //Illegal face EnvironmentalTip_MOVEMENT //Please keep the relatively static</code></pre> <p>MotionType</p> <pre> <code>typedef NS_ENUM (NSInteger,MotionType) { DETECTION_EyeBlink_FIRST = 3001, //First blink DETECTION_EyeBlink_SECOND, //Second blink DETECTION_EyeBlink_THREE //Third blink } ;</code></pre> <p>ErrorType</p> <pre> <code>typedef NS_ENUM (NSInteger,ErrorType) { Detection_ERROR_TimeOut = 4001, //Timeout-DEMO reserved Detection_ERROR_Attack, //nonliving Detection_ERROR_ForcedOut, //Forceout-DEMO reserved Detection_ERROR_Permission //Camera without permission-DEMO reserved };</code></pre> <p>&nbsp;</p> <p><strong>FAQ</strong></p> <p>Because it needs to be compatible with C++, we should change the suffix <strong>.m</strong> to <strong>.mm</strong> when we use&nbsp;<strong><code>PAFaceDetectManager.h</code></strong></p>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products