OliveappCameraPreviewController.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // CameraPreviewViewController.h
  3. // LivenessDetector
  4. //
  5. // Created by Jiteng Hao on 16/1/15.
  6. // Copyright © 2016年 Oliveapp. All rights reserved.
  7. //
  8. // 这个类可以启动摄像头并设置获取摄像头每一帧图像的回调
  9. //
  10. #import <AVFoundation/AVFoundation.h>
  11. #import "OliveappCameraPreviewDelegate.h"
  12. #import "OliveappCameraImageCaptureDelegate.h"
  13. @interface OliveappCameraPreviewController : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
  14. /**
  15. * 启动摄像头
  16. * @param facing 摄像头朝向
  17. * @param resolution 设置相机Preview的分辨率
  18. *
  19. * @return 初始化是否成功。注意:如果初始化不成功会弹出提示框
  20. */
  21. - (BOOL) startCamera: (AVCaptureDevicePosition) facing
  22. withResolution: (NSString *) resolution;
  23. /**
  24. * 停止摄像头预览
  25. */
  26. - (void) stopCamera;
  27. /**
  28. * 设置preview,第二个参数请传nil,否则无法做活体检测
  29. *
  30. * @param previewView preview
  31. */
  32. - (void) setupPreview: (UIView *) previewView;
  33. /**
  34. * 设置摄像头预览回调
  35. * @param delegate 回调函数,每帧图像都会回调此函数
  36. */
  37. - (void) setCameraPreviewDelegate: (id<OliveappCameraPreviewDelegate>) delegate;
  38. /**
  39. * 设置摄像头照相回调
  40. * @param delegate 照相回调
  41. */
  42. - (void) setCameraImageCaptureDelegate: (id<OliveappCameraImageCaptureDelegate>) delegate;
  43. /**
  44. * 拍摄一张照片
  45. */
  46. - (void) takePhoto;
  47. @end