OliveappLivenessDetector.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // LivenessDetector.h
  3. // LivenessDetector
  4. //
  5. // Created by Xiaoyang Lin on 16/1/7.
  6. // Copyright © 2016年 Oliveapp. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "OliveappAsyncLivenessDetectorDelegate.h"
  10. #import "OliveappPhotoImage.h"
  11. #import "OliveappSessionManagerConfig.h"
  12. #import "OliveappImageForVerifyConf.h"
  13. @interface OliveappLivenessDetector : NSObject
  14. /**
  15. * 生成操作对象
  16. *
  17. * @return LivenessDetector对象
  18. */
  19. - (id) init;
  20. /**
  21. * 初始化
  22. *
  23. * @param config 活体检测模块的配置,使用默认参数的话请传nil
  24. * @param delegate 活体检测回调
  25. * @param imgConfig 设置从preview图片中截取人脸框的位置, 使用默认参数的话
  26. * @param error 错误信息
  27. * 设置动作切换模式,1是普通模式,2是手动模式
  28. * @return 初始化是否成功
  29. */
  30. - (BOOL) setConfig: (OliveappSessionManagerConfig *) config
  31. withDelegate: (id<OliveappAsyncLivenessDetectorDelegate>) delegate
  32. withImageConfig: (OliveappImageForVerifyConf *) imgConfig
  33. withError: (NSError **) error;
  34. /**
  35. * 析构函数
  36. *
  37. * @param error 错误信息
  38. *
  39. * @return 是否成功
  40. */
  41. - (BOOL) unInit: (NSError **) error;
  42. /**
  43. * 重置活体检测模块
  44. *
  45. * @param error 错误信息
  46. *
  47. * @return 是否成功
  48. */
  49. - (BOOL) restartSession: (NSError **) error;
  50. /**
  51. * 传入一帧图片进行活体检测,非阻塞
  52. *
  53. * @param photoContent 传入的照片类
  54. * @param error 错误信息
  55. *
  56. * @return 是否传入成功,如果后台处理帧数太多将会丢弃
  57. */
  58. - (BOOL) doDetection: (OliveappPhotoImage *) photoContent
  59. withError: (NSError **) error;
  60. /**
  61. 根据UI交互调整人脸框的位置,采用百分比,请务必设置正确
  62. @param xPercent 需要检测人脸左上角坐标x占全宽的百分比
  63. @param yPercent 需要检测人脸左上角坐标y占全宽的百分比
  64. @param widthPercent 需要检测人脸宽度占全宽的百分比
  65. @param heightPercent 需要检测人脸高度占全宽的百分比
  66. */
  67. - (void) setFaceLocation:(float) xPercent
  68. withYpercent:(float) yPercent
  69. withWidthPercent:(float) widthPercent
  70. withHeightPercent:(float) heightPercent;
  71. @end