diff --git a/mediapipe/tasks/ios/test/vision/face_landmarker/MPPFaceLandmarkerTests.mm b/mediapipe/tasks/ios/test/vision/face_landmarker/MPPFaceLandmarkerTests.mm index 3ebc8946..9e92b76c 100644 --- a/mediapipe/tasks/ios/test/vision/face_landmarker/MPPFaceLandmarkerTests.mm +++ b/mediapipe/tasks/ios/test/vision/face_landmarker/MPPFaceLandmarkerTests.mm @@ -137,8 +137,8 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; NSError *error; MPPImage *mppImage = [self imageWithFileInfo:kCatImage]; - MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectInImage:mppImage - error:&error]; + MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectImage:mppImage + error:&error]; XCTAssertNil(error); XCTAssertNotNil(faceLandmarkerResult); XCTAssertEqualObjects(faceLandmarkerResult.faceLandmarks, [NSArray array]); @@ -158,9 +158,9 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; NSArray *expectedLandmarks = [MPPFaceLandmarkerTests expectedLandmarksFromFileInfo:kPortraitExpectedLandmarksName]; for (int i = 0; i < 3; i++) { - MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectInVideoFrame:image - timestampInMilliseconds:i - error:nil]; + MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectVideoFrame:image + timestampInMilliseconds:i + error:nil]; [self assertFaceLandmarkerResult:faceLandmarkerResult containsExpectedLandmarks:expectedLandmarks expectedBlendshapes:NULL @@ -200,7 +200,7 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; }; for (int i = 0; i < iterationCount; i++) { - XCTAssertTrue([faceLandmarker detectAsyncInImage:image timestampInMilliseconds:i error:nil]); + XCTAssertTrue([faceLandmarker detectAsyncImage:image timestampInMilliseconds:i error:nil]); } NSTimeInterval timeout = 0.5f; @@ -224,10 +224,10 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; }; MPPImage *image = [self imageWithFileInfo:kPortraitImage]; - XCTAssertTrue([faceLandmarker detectAsyncInImage:image timestampInMilliseconds:1 error:nil]); + XCTAssertTrue([faceLandmarker detectAsyncImage:image timestampInMilliseconds:1 error:nil]); NSError *error; - XCTAssertFalse([faceLandmarker detectAsyncInImage:image timestampInMilliseconds:0 error:&error]); + XCTAssertFalse([faceLandmarker detectAsyncImage:image timestampInMilliseconds:0 error:&error]); NSError *expectedError = [NSError errorWithDomain:kExpectedErrorDomain @@ -292,9 +292,9 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; MPPImage *image = [self imageWithFileInfo:kPortraitImage]; NSError *liveStreamAPICallError; - XCTAssertFalse([faceLandmarker detectAsyncInImage:image - timestampInMilliseconds:0 - error:&liveStreamAPICallError]); + XCTAssertFalse([faceLandmarker detectAsyncImage:image + timestampInMilliseconds:0 + error:&liveStreamAPICallError]); NSError *expectedLiveStreamAPICallError = [NSError errorWithDomain:kExpectedErrorDomain @@ -306,9 +306,9 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; AssertEqualErrors(liveStreamAPICallError, expectedLiveStreamAPICallError); NSError *videoAPICallError; - XCTAssertFalse([faceLandmarker detectInVideoFrame:image - timestampInMilliseconds:0 - error:&videoAPICallError]); + XCTAssertFalse([faceLandmarker detectVideoFrame:image + timestampInMilliseconds:0 + error:&videoAPICallError]); NSError *expectedVideoAPICallError = [NSError errorWithDomain:kExpectedErrorDomain @@ -329,9 +329,9 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; MPPImage *image = [self imageWithFileInfo:kPortraitImage]; NSError *liveStreamAPICallError; - XCTAssertFalse([faceLandmarker detectAsyncInImage:image - timestampInMilliseconds:0 - error:&liveStreamAPICallError]); + XCTAssertFalse([faceLandmarker detectAsyncImage:image + timestampInMilliseconds:0 + error:&liveStreamAPICallError]); NSError *expectedLiveStreamAPICallError = [NSError errorWithDomain:kExpectedErrorDomain @@ -343,7 +343,7 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; AssertEqualErrors(liveStreamAPICallError, expectedLiveStreamAPICallError); NSError *imageAPICallError; - XCTAssertFalse([faceLandmarker detectInImage:image error:&imageAPICallError]); + XCTAssertFalse([faceLandmarker detectImage:image error:&imageAPICallError]); NSError *expectedImageAPICallError = [NSError errorWithDomain:kExpectedErrorDomain @@ -365,7 +365,7 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; MPPImage *image = [self imageWithFileInfo:kPortraitImage]; NSError *imageAPICallError; - XCTAssertFalse([faceLandmarker detectInImage:image error:&imageAPICallError]); + XCTAssertFalse([faceLandmarker detectImage:image error:&imageAPICallError]); NSError *expectedImageAPICallError = [NSError errorWithDomain:kExpectedErrorDomain @@ -377,9 +377,9 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; AssertEqualErrors(imageAPICallError, expectedImageAPICallError); NSError *videoAPICallError; - XCTAssertFalse([faceLandmarker detectInVideoFrame:image - timestampInMilliseconds:0 - error:&videoAPICallError]); + XCTAssertFalse([faceLandmarker detectVideoFrame:image + timestampInMilliseconds:0 + error:&videoAPICallError]); NSError *expectedVideoAPICallError = [NSError errorWithDomain:kExpectedErrorDomain @@ -539,8 +539,8 @@ constexpr float kFacialTransformationMatrixErrorThreshold = 0.2f; MPPImage *mppImage = [self imageWithFileInfo:fileInfo]; NSError *error; - MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectInImage:mppImage - error:&error]; + MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectImage:mppImage + error:&error]; XCTAssertNil(error); XCTAssertNotNil(faceLandmarkerResult); diff --git a/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.h b/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.h index ce4e991d..53cb8ecd 100644 --- a/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.h +++ b/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.h @@ -71,8 +71,8 @@ NS_SWIFT_NAME(FaceLandmarker) * @return An `FaceLandmarkerResult` that contains a list of landmarks. `nil` if there is an error * in initializing the face landmaker. */ -- (nullable MPPFaceLandmarkerResult *)detectInImage:(MPPImage *)image - error:(NSError **)error NS_SWIFT_NAME(detect(image:)); +- (nullable MPPFaceLandmarkerResult *)detectImage:(MPPImage *)image + error:(NSError **)error NS_SWIFT_NAME(detect(image:)); /** * Performs face landmark detection on the provided video frame of type `MPImage` using the whole @@ -95,9 +95,9 @@ NS_SWIFT_NAME(FaceLandmarker) * @return An `FaceLandmarkerResult` that contains a list of landmarks. `nil` if there is an * error in initializing the face landmaker. */ -- (nullable MPPFaceLandmarkerResult *)detectInVideoFrame:(MPPImage *)image - timestampInMilliseconds:(NSInteger)timestampInMilliseconds - error:(NSError **)error +- (nullable MPPFaceLandmarkerResult *)detectVideoFrame:(MPPImage *)image + timestampInMilliseconds:(NSInteger)timestampInMilliseconds + error:(NSError **)error NS_SWIFT_NAME(detect(videoFrame:timestampInMilliseconds:)); /** @@ -132,7 +132,7 @@ NS_SWIFT_NAME(FaceLandmarker) * * @return `true` if the image was sent to the task successfully, otherwise `false`. */ -- (BOOL)detectAsyncInImage:(MPPImage *)image +- (BOOL)detectAsyncImage:(MPPImage *)image timestampInMilliseconds:(NSInteger)timestampInMilliseconds error:(NSError **)error NS_SWIFT_NAME(detectAsync(image:timestampInMilliseconds:)); diff --git a/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.mm b/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.mm index 820ab44a..8a128475 100644 --- a/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.mm +++ b/mediapipe/tasks/ios/vision/face_landmarker/sources/MPPFaceLandmarker.mm @@ -154,15 +154,15 @@ static NSString *const kTaskName = @"faceLandmarker"; return [self initWithOptions:options error:error]; } -- (nullable MPPFaceLandmarkerResult *)detectInImage:(MPPImage *)image error:(NSError **)error { +- (nullable MPPFaceLandmarkerResult *)detectImage:(MPPImage *)image error:(NSError **)error { std::optional outputPacketMap = [_visionTaskRunner processImage:image error:error]; return [MPPFaceLandmarker faceLandmarkerResultWithOptionalOutputPacketMap:outputPacketMap]; } -- (nullable MPPFaceLandmarkerResult *)detectInVideoFrame:(MPPImage *)image - timestampInMilliseconds:(NSInteger)timestampInMilliseconds - error:(NSError **)error { +- (nullable MPPFaceLandmarkerResult *)detectVideoFrame:(MPPImage *)image + timestampInMilliseconds:(NSInteger)timestampInMilliseconds + error:(NSError **)error { std::optional outputPacketMap = [_visionTaskRunner processVideoFrame:image timestampInMilliseconds:timestampInMilliseconds @@ -171,7 +171,7 @@ static NSString *const kTaskName = @"faceLandmarker"; return [MPPFaceLandmarker faceLandmarkerResultWithOptionalOutputPacketMap:outputPacketMap]; } -- (BOOL)detectAsyncInImage:(MPPImage *)image +- (BOOL)detectAsyncImage:(MPPImage *)image timestampInMilliseconds:(NSInteger)timestampInMilliseconds error:(NSError **)error { return [_visionTaskRunner processLiveStreamImage:image