diff --git a/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarker.h b/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarker.h index 5a954af46..a405c0fa4 100644 --- a/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarker.h +++ b/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarker.h @@ -48,82 +48,81 @@ NS_SWIFT_NAME(HandLandmarker) @property(class, nonatomic, readonly) NSArray *handConnections; /** - * Creates a new instance of `MPPHandLandmarker` from an absolute path to a model asset bundle - * stored locally on the device and the default `MPPHandLandmarkerOptions`. + * Creates a new instance of `HandLandmarker` from an absolute path to a model asset bundle stored + * locally on the device and the default `HandLandmarkerOptions`. * * @param modelPath An absolute path to a model asset bundle stored locally on the device. * @param error An optional error parameter populated when there is an error in initializing the * hand landmarker. * - * @return A new instance of `MPPHandLandmarker` with the given model path. `nil` if there is an - * error in initializing the hand landmarker. + * @return A new instance of `HandLandmarker` with the given model path. `nil` if there is an error + * in initializing the hand landmarker. */ - (nullable instancetype)initWithModelPath:(NSString *)modelPath error:(NSError **)error; /** - * Creates a new instance of `MPPHandLandmarker` from the given `MPPHandLandmarkerOptions`. + * Creates a new instance of `HandLandmarker` from the given `HandLandmarkerOptions`. * - * @param options The options of type `MPPHandLandmarkerOptions` to use for configuring the - * `MPPHandLandmarker`. + * @param options The options of type `HandLandmarkerOptions` to use for configuring the + * `HandLandmarker`. * @param error An optional error parameter populated when there is an error in initializing the * hand landmarker. * - * @return A new instance of `MPPHandLandmarker` with the given options. `nil` if there is an - * error in initializing the hand landmarker. + * @return A new instance of `HandLandmarker` with the given options. `nil` if there is an error in + * initializing the hand landmarker. */ - (nullable instancetype)initWithOptions:(MPPHandLandmarkerOptions *)options error:(NSError **)error NS_DESIGNATED_INITIALIZER; /** - * Performs hand landmarks detection on the provided `MPPImage` using the whole image as region of + * Performs hand landmarks detection on the provided `MPImage` using the whole image as region of * interest. Rotation will be applied according to the `orientation` property of the provided - * `MPPImage`. Only use this method when the `MPPHandLandmarker` is created with - * `MPPRunningModeImage`. + * `MPImage`. Only use this method when the `HandLandmarker` is created with running mode, `.image`. * - * This method supports performing hand landmarks detection on RGBA images. If your `MPPImage` has a - * source type of `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the - * underlying pixel buffer must have one of the following pixel format types: + * This method supports performing hand landmarks detection on RGBA images. If your `MPImage` has a + * source type of `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of + * the following pixel format types: * 1. kCVPixelFormatType_32BGRA * 2. kCVPixelFormatType_32RGBA * - * If your `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color space is - * RGB with an Alpha channel. + * If your `MPImage` has a source type of `.image` ensure that the color space is RGB with an Alpha + * channel. * - * @param image The `MPPImage` on which hand landmarks detection is to be performed. + * @param image The `MPImage` on which hand landmarks detection is to be performed. * @param error An optional error parameter populated when there is an error in performing hand * landmarks detection on the input image. * - * @return An `MPPHandLandmarkerResult` object that contains the hand hand landmarks detection + * @return An `HandLandmarkerResult` object that contains the hand hand landmarks detection * results. */ - (nullable MPPHandLandmarkerResult *)detectInImage:(MPPImage *)image error:(NSError **)error NS_SWIFT_NAME(detect(image:)); /** - * Performs hand landmarks detection on the provided video frame of type `MPPImage` using the whole + * Performs hand landmarks detection on the provided video frame of type `MPImage` using the whole * image as region of interest. Rotation will be applied according to the `orientation` property of - * the provided `MPPImage`. Only use this method when the `MPPHandLandmarker` is created with - * `MPPRunningModeVideo`. + * the provided `MPImage`. Only use this method when the `HandLandmarker` is created with running + * mode, `.video`. * * It's required to provide the video frame's timestamp (in milliseconds). The input timestamps must * be monotonically increasing. * - * This method supports performing hand landmarks detection on RGBA images. If your `MPPImage` has a - * source type of `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the - * underlying pixel buffer must have one of the following pixel format types: + * This method supports performing hand landmarks detection on RGBA images. If your `MPImage` has a + * source type of `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of + * the following pixel format types: * 1. kCVPixelFormatType_32BGRA * 2. kCVPixelFormatType_32RGBA * - * If your `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color space is - * RGB with an Alpha channel. + * If your `MPImage` has a source type of `.image` ensure that the color space is RGB with an Alpha + * channel. * - * @param image The `MPPImage` on which hand landmarks detection is to be performed. + * @param image The `MPImage` on which hand landmarks detection is to be performed. * @param timestampInMilliseconds The video frame's timestamp (in milliseconds). The input * timestamps must be monotonically increasing. * @param error An optional error parameter populated when there is an error in performing hand * landmarks detection on the input video frame. * - * @return An `MPPHandLandmarkerResult` object that contains the hand hand landmarks detection + * @return An `HandLandmarkerResult` object that contains the hand hand landmarks detection * results. */ - (nullable MPPHandLandmarkerResult *)detectInVideoFrame:(MPPImage *)image @@ -132,33 +131,32 @@ NS_SWIFT_NAME(HandLandmarker) NS_SWIFT_NAME(detect(videoFrame:timestampInMilliseconds:)); /** - * Sends live stream image data of type `MPPImage` to perform hand landmarks detection using the + * Sends live stream image data of type `MPImage` to perform hand landmarks detection using the * whole image as region of interest. Rotation will be applied according to the `orientation` - * property of the provided `MPPImage`. Only use this method when the `MPPHandLandmarker` is created - * with `MPPRunningModeLiveStream`. + * property of the provided `MPImage`. Only use this method when the `HandLandmarker` is created + * with running mode, `.liveStream`. * * The object which needs to be continuously notified of the available results of hand landmarks - * detection must confirm to `MPPHandLandmarkerLiveStreamDelegate` protocol and implement the - * `handLandmarker:didFinishDetectionWithResult:timestampInMilliseconds:error:` - * delegate method. + * detection must confirm to `HandLandmarkerLiveStreamDelegate` protocol and implement the + * `handLandmarker(_:didFinishDetectionWithResult:timestampInMilliseconds:error:)` delegate method. * * It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent * to the hand landmarker. The input timestamps must be monotonically increasing. * - * This method supports performing hand landmarks detection on RGBA images. If your `MPPImage` has a - * source type of `MPPImageSourceTypePixelBuffer` or `MPPImageSourceTypeSampleBuffer`, the - * underlying pixel buffer must have one of the following pixel format types: + * This method supports performing hand landmarks detection on RGBA images. If your `MPImage` has a + * source type of `.pixelBuffer` or `.sampleBuffer`, the underlying pixel buffer must have one of + * the following pixel format types: * 1. kCVPixelFormatType_32BGRA * 2. kCVPixelFormatType_32RGBA * - * If the input `MPPImage` has a source type of `MPPImageSourceTypeImage` ensure that the color - * space is RGB with an Alpha channel. + * If the input `MPImage` has a source type of `.image` ensure that the color space is RGB with an + * Alpha channel. * * If this method is used for performing hand landmarks detection on live camera frames using * `AVFoundation`, ensure that you request `AVCaptureVideoDataOutput` to output frames in * `kCMPixelFormat_32RGBA` using its `videoSettings` property. * - * @param image A live stream image data of type `MPPImage` on which hand landmarks detection is to + * @param image A live stream image data of type `MPImage` on which hand landmarks detection is to * be performed. * @param timestampInMilliseconds The timestamp (in milliseconds) which indicates when the input * image is sent to the hand landmarker. The input timestamps must be monotonically increasing. diff --git a/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerOptions.h b/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerOptions.h index 4da78ecc1..efa5c3648 100644 --- a/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerOptions.h +++ b/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerOptions.h @@ -23,11 +23,11 @@ NS_ASSUME_NONNULL_BEGIN @class MPPHandLandmarker; /** - * This protocol defines an interface for the delegates of `MPPHandLandmarker` object to receive - * results of performing asynchronous hand landmark detection on images (i.e, when `runningMode` = - * `MPPRunningModeLiveStream`). + * This protocol defines an interface for the delegates of `HandLandmarker` object to receive + * results of performing asynchronous hand landmark detection on images (i.e, when + * `runningMode` = `.liveStream`). * - * The delegate of `MPPHandLandmarker` must adopt `MPPHandLandmarkerLiveStreamDelegate` protocol. + * The delegate of `HandLandmarker` must adopt `HandLandmarkerLiveStreamDelegate` protocol. * The methods in this protocol are optional. */ NS_SWIFT_NAME(HandLandmarkerLiveStreamDelegate) @@ -37,14 +37,14 @@ NS_SWIFT_NAME(HandLandmarkerLiveStreamDelegate) /** * This method notifies a delegate that the results of asynchronous hand landmark detection of an - * image submitted to the `MPPHandLandmarker` is available. + * image submitted to the `HandLandmarker` is available. * - * This method is called on a private serial dispatch queue created by the `MPPHandLandmarker` - * for performing the asynchronous delegates calls. + * This method is called on a private serial dispatch queue created by the `HandLandmarker` for + * performing the asynchronous delegates calls. * * @param handLandmarker The hand landmarker which performed the hand landmarking. - * This is useful to test equality when there are multiple instances of `MPPHandLandmarker`. - * @param result The `MPPHandLandmarkerResult` object that contains a list of detections, each + * This is useful to test equality when there are multiple instances of `HandLandmarker`. + * @param result The `HandLandmarkerResult` object that contains a list of detections, each * detection has a bounding box that is expressed in the unrotated input frame of reference * coordinates system, i.e. in `[0,image_width) x [0,image_height)`, which are the dimensions of the * underlying image data. @@ -60,32 +60,30 @@ NS_SWIFT_NAME(HandLandmarkerLiveStreamDelegate) NS_SWIFT_NAME(handLandmarker(_:didFinishDetection:timestampInMilliseconds:error:)); @end -/** Options for setting up a `MPPHandLandmarker`. */ +/** Options for setting up a `HandLandmarker`. */ NS_SWIFT_NAME(HandLandmarkerOptions) @interface MPPHandLandmarkerOptions : MPPTaskOptions /** - * Running mode of the hand landmarker task. Defaults to `MPPRunningModeImage`. - * `MPPHandLandmarker` can be created with one of the following running modes: - * 1. `MPPRunningModeImage`: The mode for performing hand landmark detection on single image - * inputs. - * 2. `MPPRunningModeVideo`: The mode for performing hand landmark detection on the decoded frames - * of a video. - * 3. `MPPRunningModeLiveStream`: The mode for performing hand landmark detection on a live stream - * of input data, such as from the camera. + * Running mode of the hand landmarker task. Defaults to `.image`. + * `HandLandmarker` can be created with one of the following running modes: + * 1. `image`: The mode for performing hand landmark detection on single image inputs. + * 2. `video`: The mode for performing hand landmark detection on the decoded frames of a video. + * 3. `liveStream`: The mode for performing hand landmark detection on a live stream of input data, + * such as from the camera. */ @property(nonatomic) MPPRunningMode runningMode; /** - * An object that confirms to `MPPHandLandmarkerLiveStreamDelegate` protocol. This object must + * An object that confirms to `HandLandmarkerLiveStreamDelegate` protocol. This object must * implement `handLandmarker:didFinishDetectionWithResult:timestampInMilliseconds:error:` to * receive the results of performing asynchronous hand landmark detection on images (i.e, when - * `runningMode` = `MPPRunningModeLiveStream`). + * `runningMode` = `.liveStream`). */ @property(nonatomic, weak, nullable) id handLandmarkerLiveStreamDelegate; -/** The maximum number of hands that can be detected by the `MPPHandLandmarker`. */ +/** The maximum number of hands that can be detected by the `HandLandmarker`. */ @property(nonatomic) NSInteger numHands; /** The minimum confidence score for the hand detection to be considered successful. */ diff --git a/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerResult.h b/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerResult.h index 238aa406a..2c00e9ee5 100644 --- a/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerResult.h +++ b/mediapipe/tasks/ios/vision/hand_landmarker/sources/MPPHandLandmarkerResult.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN -/** Represents the hand landmarker results generated by MPPHandLandmarker. */ +/** Represents the hand landmarker results generated by `HandLandmarker`. */ NS_SWIFT_NAME(HandLandmarkerResult) @interface MPPHandLandmarkerResult : MPPTaskResult @@ -34,15 +34,15 @@ NS_SWIFT_NAME(HandLandmarkerResult) @property(nonatomic, readonly) NSArray *> *handedness; /** - * Initializes a new `MPPHandLandmarkerResult` with the given landmarks, world landmarks, - * handedness and timestamp (in milliseconds). + * Initializes a new `HandLandmarkerResult` with the given landmarks, world landmarks, handedness + * and timestamp (in milliseconds). * * @param landmarks The hand landmarks of detected hands. * @param worldLandmarks The hand landmarks in world coordniates of detected hands. * @param handedness The handedness of detected hands. * @param timestampInMilliseconds The timestamp for this result. * - * @return An instance of `MPPGHandLandmarkerResult` initialized with the given landmarks, world + * @return An instance of `HandLandmarkerResult` initialized with the given landmarks, world * landmarks, handedness and timestamp (in milliseconds). * */