2014 snapchat source code
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.

43 lines
1.5 KiB

  1. //
  2. // SCCaptureFaceDetectionParser.h
  3. // Snapchat
  4. //
  5. // Created by Jiyang Zhu on 3/13/18.
  6. // Copyright © 2018 Snapchat, Inc. All rights reserved.
  7. //
  8. // This class offers methods to parse face bounds from raw data, e.g., AVMetadataObject, CIFeature.
  9. #import <SCBase/SCMacros.h>
  10. #import <AVFoundation/AVFoundation.h>
  11. #import <CoreImage/CoreImage.h>
  12. @interface SCCaptureFaceDetectionParser : NSObject
  13. SC_INIT_AND_NEW_UNAVAILABLE;
  14. - (instancetype)initWithFaceBoundsAreaThreshold:(CGFloat)minimumArea;
  15. /**
  16. Parse face bounds from AVMetadataObject.
  17. @param metadataObjects An array of AVMetadataObject.
  18. @return A dictionary, value is faceBounds: CGRect, key is faceID: NSString.
  19. */
  20. - (NSDictionary<NSNumber *, NSValue *> *)parseFaceBoundsByFaceIDFromMetadataObjects:
  21. (NSArray<__kindof AVMetadataObject *> *)metadataObjects;
  22. /**
  23. Parse face bounds from CIFeature.
  24. @param features An array of CIFeature.
  25. @param imageSize Size of the image, where the feature are detected from.
  26. @param imageOrientation Orientation of the image.
  27. @return A dictionary, value is faceBounds: CGRect, key is faceID: NSString.
  28. */
  29. - (NSDictionary<NSNumber *, NSValue *> *)parseFaceBoundsByFaceIDFromCIFeatures:(NSArray<__kindof CIFeature *> *)features
  30. withImageSize:(CGSize)imageSize
  31. imageOrientation:
  32. (CGImagePropertyOrientation)imageOrientation;
  33. @end