Add FaceLandmarker constants for iOS

PiperOrigin-RevId: 539160195
This commit is contained in:
Sebastian Schmidt 2023-06-09 13:13:16 -07:00 committed by Copybara-Service
parent fb47218e10
commit 67c5d8d224
4 changed files with 2887 additions and 0 deletions

View File

@ -43,6 +43,13 @@ objc_library(
],
)
objc_library(
name = "MPPFaceLandmarksConnections",
hdrs = ["sources/MPPFaceLandmarksConnections.h"],
module_name = "MPPFaceLandmarksConnections",
deps = ["//mediapipe/tasks/ios/components/containers:MPPConnection"],
)
objc_library(
name = "MPPFaceLandmarker",
srcs = ["sources/MPPFaceLandmarker.mm"],
@ -55,9 +62,11 @@ objc_library(
deps = [
":MPPFaceLandmarkerOptions",
":MPPFaceLandmarkerResult",
":MPPFaceLandmarksConnections",
"//mediapipe/tasks/cc/vision/face_landmarker:face_landmarker_graph",
"//mediapipe/tasks/ios/common/utils:MPPCommonUtils",
"//mediapipe/tasks/ios/common/utils:NSStringHelpers",
"//mediapipe/tasks/ios/components/containers:MPPConnection",
"//mediapipe/tasks/ios/core:MPPTaskInfo",
"//mediapipe/tasks/ios/vision/core:MPPImage",
"//mediapipe/tasks/ios/vision/core:MPPVisionPacketCreator",

View File

@ -14,6 +14,7 @@
#import <Foundation/Foundation.h>
#import "mediapipe/tasks/ios/components/containers/sources/MPPConnection.h"
#import "mediapipe/tasks/ios/vision/core/sources/MPPImage.h"
#import "mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarkerOptions.h"
#import "mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarkerResult.h"
@ -147,6 +148,83 @@ NS_SWIFT_NAME(FaceLandmarker)
error:(NSError **)error
NS_SWIFT_NAME(detectAsync(image:timestampInMilliseconds:));
/**
* Returns the connections between all the landmarks in the lips.
*
* @return An array of connections between all the landmarks in the lips.
*/
+ (NSArray<MPPConnection *> *)lipsConnections;
/**
* Returns the connections between all the landmarks in the left eye.
*
* @return An array of connections between all the landmarks in the left eye.
*/
+ (NSArray<MPPConnection *> *)leftEyeConnections;
/**
* Returns the connections between all the landmarks in the left eyebrow.
*
* @return An array of connections between all the landmarks in the left eyebrow.
*/
+ (NSArray<MPPConnection *> *)leftEyebrowConnections;
/**
* Returns the connections between all the landmarks in the left iris.
*
* @return An array of connections between all the landmarks in the left iris.
*/
+ (NSArray<MPPConnection *> *)leftIrisConnections;
/**
* Returns the connections between all the landmarks in the right eye.
*
* @return An array of connections between all the landmarks in the right eyr.
*/
+ (NSArray<MPPConnection *> *)rightEyeConnections;
/**
* Returns the connections between all the landmarks in the right eyebrow.
*
* @return An array of connections between all the landmarks in the right eyebrow.
*/
+ (NSArray<MPPConnection *> *)rightEyebrowConnections;
/**
* Returns the connections between all the landmarks in the right iris.
*
* @return An array of connections between all the landmarks in the right iris.
*/
+ (NSArray<MPPConnection *> *)rightIrisConnections;
/**
* Returns the connections between all the landmarks of the face oval.
*
* @return An array of connections between all the landmarks of the face oval.
*/
+ (NSArray<MPPConnection *> *)faceOvalConnections;
/**
* Returns the connections between making up the contours of the face.
*
* @return An array of connections between all the contours of the face.
*/
+ (NSArray<MPPConnection *> *)contoursConnections;
/**
* Returns the connections between all the landmarks making up the tesselation of the face.
*
* @return An array of connections between all the landmarks making up the tesselation of the face.
*/
+ (NSArray<MPPConnection *> *)tesselationConnections;
/**
* Returns the connections between all the landmarks in the face.
*
* @return An array of connections between all the landmarks in the face.
*/
+ (NSArray<MPPConnection *> *)faceConnections;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

View File

@ -20,6 +20,7 @@
#import "mediapipe/tasks/ios/core/sources/MPPTaskInfo.h"
#import "mediapipe/tasks/ios/vision/core/sources/MPPVisionPacketCreator.h"
#import "mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunner.h"
#import "mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarksConnections.h"
#import "mediapipe/tasks/ios/vision/face_landmarker/utils/sources/MPPFaceLandmarkerOptions+Helpers.h"
#import "mediapipe/tasks/ios/vision/face_landmarker/utils/sources/MPPFaceLandmarkerResult+Helpers.h"
@ -277,4 +278,48 @@ static NSString *const kTaskName = @"faceLandmarker";
});
}
+ (NSArray<MPPConnection *> *)lipsConnections {
return MPPFaceLandmarksLips;
}
+ (NSArray<MPPConnection *> *)leftEyeConnections {
return MPPFaceLandmarksLeftEye;
}
+ (NSArray<MPPConnection *> *)leftEyebrowConnections {
return MPPFaceLandmarksLeftEyebrow;
}
+ (NSArray<MPPConnection *> *)leftIrisConnections {
return MPPFaceLandmarksLeftIris;
}
+ (NSArray<MPPConnection *> *)rightEyeConnections {
return MPPFaceLandmarksRightEye;
}
+ (NSArray<MPPConnection *> *)rightEyebrowConnections {
return MPPFaceLandmarksRightEyebrow;
}
+ (NSArray<MPPConnection *> *)rightIrisConnections {
return MPPFaceLandmarksLeftIris;
}
+ (NSArray<MPPConnection *> *)faceOvalConnections {
return MPPFaceLandmarksFaceOval;
}
+ (NSArray<MPPConnection *> *)contoursConnections {
return MPPFaceLandmarksContours;
}
+ (NSArray<MPPConnection *> *)tesselationConnections {
return MPPFaceLandmarksTesselation;
}
+ (NSArray<MPPConnection *> *)faceConnections {
return MPPFaceConnections;
}
@end

File diff suppressed because it is too large Load Diff