洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.1 KiB

7 months ago
  1. //
  2. // Toyger.h
  3. // ToygerAlgorithm
  4. //
  5. // Created by 王伟伟 on 2018/1/22.
  6. // Copyright © 2018年 DTF. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <ToygerService/ToygerPublicDefine.h>
  10. #import <ToygerService/ToygerConfig.h>
  11. #ifdef USE_SENSOR
  12. #import <ToygerService/ToygerSensorHandler.h>
  13. #endif
  14. @class ToygerServiceInstance;
  15. @class ToygerFrame;
  16. //extern NSString *const kCipherDataKey;
  17. //extern NSString *const kDTFPubKey;
  18. //extern NSString *const kUserIDKey;
  19. @protocol ToygerServiceInstanceDelegate<NSObject>
  20. /**
  21. ToygerService处理完一帧后的状态更新的回调
  22. @param instance
  23. @param frame
  24. */
  25. - (void)toygerService:(ToygerServiceInstance *)instance frameDidUpdate:(ToygerFrame *)frame;
  26. /**
  27. ToygerService事件触发
  28. @param instance
  29. @param eventDict Dictionary
  30. */
  31. - (void)toygerService:(ToygerServiceInstance *)instance triggerEvent:(NSDictionary *)eventDict;
  32. /**
  33. ToygerService埋点
  34. @param instance
  35. @param eventDict
  36. */
  37. - (void)toygerService:(ToygerServiceInstance *)instance triggerMonitor:(NSDictionary *)monitorDataDict;
  38. /**
  39. ToygerService采集结束
  40. @param instance
  41. @param completionDict
  42. */
  43. - (void)toygerService:(ToygerServiceInstance *)instance captureDidComplete:(NSDictionary *)completionDict;
  44. @optional
  45. /**
  46. ToygerService采集到一张高清人脸大图
  47. @param instance
  48. @param image Image
  49. */
  50. - (void)toygerService:(ToygerServiceInstance *)instance didGetHighQualityImage:(UIImage *)image;
  51. @end
  52. @interface ToygerServiceInstance : NSObject
  53. /**
  54. */
  55. @property (nonatomic, strong) ToygerConfig *config;
  56. /**
  57. ToygerInstace的代理
  58. */
  59. @property (nonatomic, weak) id<ToygerServiceInstanceDelegate> delegate;
  60. /**
  61. */
  62. @property (nonatomic, strong)NSString *aesCipher;
  63. /**
  64. Toyger算法.
  65. @return Toyger算法实例
  66. */
  67. - (instancetype)initWithType:(ToygerServiceType)type andExtInfo:(NSDictionary *)extInfo errorPtr:(NSError **)errorPtr NS_DESIGNATED_INITIALIZER;
  68. /**
  69. Toyger算法处理图片
  70. @param sampleBuffer SampleBuffer
  71. */
  72. - (void)processImage:(CMSampleBufferRef)sampleBuffer byOrientation:(UIImageOrientation)orientation extraInfo:(NSDictionary *)extra;
  73. /**
  74. Toyger处理最佳图
  75. */
  76. - (void)processBestImage;
  77. #ifdef USE_SENSOR
  78. - (void)processSensorData:(ToygerSensorData *) sensorData withExtraInfo:(NSDictionary *)extra;
  79. #endif
  80. /**
  81. @param image
  82. @return
  83. */
  84. - (NSData *)dataWithSurveillance:(NSArray<UIImage *> *)surveillance byType:(ToygerServiceType)toygerType extraInfo:(NSDictionary *)extraInfo;
  85. - (NSData *)dataWithDocCaptureImage:(UIImage *)image andAeskey:(NSString *)aesKey extraInfo:(NSDictionary *)extraInfo;
  86. /**
  87. */
  88. - (void)reset;
  89. /**
  90. MetaInfo
  91. @return metaInfo
  92. */
  93. + (NSArray<NSString *> *)metaInfo;
  94. /**
  95. +
  96. */
  97. +(NSInteger)getToygerState;
  98. @end