Updated iOS hand landmarker Objective C API names
This commit is contained in:
parent
9d42744f8a
commit
435bee71e8
|
@ -208,10 +208,10 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
return image;
|
||||
}
|
||||
|
||||
- (MPPHandLandmarkerResult *)detectInImageWithFileInfo:(ResourceFileInfo *)imageFileInfo
|
||||
- (MPPHandLandmarkerResult *)detectImageWithFileInfo:(ResourceFileInfo *)imageFileInfo
|
||||
usingHandLandmarker:(MPPHandLandmarker *)handLandmarker {
|
||||
MPPImage *mppImage = [self imageWithFileInfo:imageFileInfo];
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectInImage:mppImage error:nil];
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectImage:mppImage error:nil];
|
||||
XCTAssertNotNil(handLandmarkerResult);
|
||||
|
||||
return handLandmarkerResult;
|
||||
|
@ -221,7 +221,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
usingHandLandmarker:(MPPHandLandmarker *)handLandmarker
|
||||
approximatelyEqualsHandLandmarkerResult:
|
||||
(MPPHandLandmarkerResult *)expectedHandLandmarkerResult {
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [self detectInImageWithFileInfo:fileInfo
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [self detectImageWithFileInfo:fileInfo
|
||||
usingHandLandmarker:handLandmarker];
|
||||
[self assertHandLandmarkerResult:handLandmarkerResult
|
||||
isApproximatelyEqualToExpectedResult:expectedHandLandmarkerResult];
|
||||
|
@ -249,7 +249,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:handLandmarkerOptions];
|
||||
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [self detectInImageWithFileInfo:kNoHandsImage
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [self detectImageWithFileInfo:kNoHandsImage
|
||||
usingHandLandmarker:handLandmarker];
|
||||
AssertHandLandmarkerResultIsEmpty(handLandmarkerResult);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:handLandmarkerOptions];
|
||||
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [self detectInImageWithFileInfo:kTwoHandsImage
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [self detectImageWithFileInfo:kTwoHandsImage
|
||||
usingHandLandmarker:handLandmarker];
|
||||
|
||||
XCTAssertTrue(handLandmarkerResult.handedness.count == numHands);
|
||||
|
@ -280,7 +280,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *mppImage = [self imageWithFileInfo:kPointingUpRotatedImage
|
||||
orientation:UIImageOrientationRight];
|
||||
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectInImage:mppImage error:nil];
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectImage:mppImage error:nil];
|
||||
|
||||
[self assertHandLandmarkerResult:handLandmarkerResult
|
||||
isApproximatelyEqualToExpectedResult:[MPPHandLandmarkerTests
|
||||
|
@ -339,7 +339,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
NSError *liveStreamApiCallError;
|
||||
XCTAssertFalse([handLandmarker detectAsyncInImage:image
|
||||
XCTAssertFalse([handLandmarker detectAsyncImage:image
|
||||
timestampInMilliseconds:0
|
||||
error:&liveStreamApiCallError]);
|
||||
|
||||
|
@ -354,7 +354,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
AssertEqualErrors(liveStreamApiCallError, expectedLiveStreamApiCallError);
|
||||
|
||||
NSError *videoApiCallError;
|
||||
XCTAssertFalse([handLandmarker detectInVideoFrame:image
|
||||
XCTAssertFalse([handLandmarker detectVideoFrame:image
|
||||
timestampInMilliseconds:0
|
||||
error:&videoApiCallError]);
|
||||
|
||||
|
@ -378,7 +378,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
NSError *liveStreamApiCallError;
|
||||
XCTAssertFalse([handLandmarker detectAsyncInImage:image
|
||||
XCTAssertFalse([handLandmarker detectAsyncImage:image
|
||||
timestampInMilliseconds:0
|
||||
error:&liveStreamApiCallError]);
|
||||
|
||||
|
@ -393,7 +393,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
AssertEqualErrors(liveStreamApiCallError, expectedLiveStreamApiCallError);
|
||||
|
||||
NSError *imageApiCallError;
|
||||
XCTAssertFalse([handLandmarker detectInImage:image error:&imageApiCallError]);
|
||||
XCTAssertFalse([handLandmarker detectImage:image error:&imageApiCallError]);
|
||||
|
||||
NSError *expectedImageApiCallError =
|
||||
[NSError errorWithDomain:kExpectedErrorDomain
|
||||
|
@ -416,7 +416,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
NSError *imageApiCallError;
|
||||
XCTAssertFalse([handLandmarker detectInImage:image error:&imageApiCallError]);
|
||||
XCTAssertFalse([handLandmarker detectImage:image error:&imageApiCallError]);
|
||||
|
||||
NSError *expectedImageApiCallError =
|
||||
[NSError errorWithDomain:kExpectedErrorDomain
|
||||
|
@ -428,7 +428,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
AssertEqualErrors(imageApiCallError, expectedImageApiCallError);
|
||||
|
||||
NSError *videoApiCallError;
|
||||
XCTAssertFalse([handLandmarker detectInVideoFrame:image
|
||||
XCTAssertFalse([handLandmarker detectVideoFrame:image
|
||||
timestampInMilliseconds:0
|
||||
error:&videoApiCallError]);
|
||||
|
||||
|
@ -452,7 +452,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectInVideoFrame:image
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectVideoFrame:image
|
||||
timestampInMilliseconds:i
|
||||
error:nil];
|
||||
[self assertHandLandmarkerResult:handLandmarkerResult
|
||||
|
@ -480,10 +480,10 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
|
||||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
XCTAssertTrue([handLandmarker detectAsyncInImage:image timestampInMilliseconds:1 error:nil]);
|
||||
XCTAssertTrue([handLandmarker detectAsyncImage:image timestampInMilliseconds:1 error:nil]);
|
||||
|
||||
NSError *error;
|
||||
XCTAssertFalse([handLandmarker detectAsyncInImage:image timestampInMilliseconds:0 error:&error]);
|
||||
XCTAssertFalse([handLandmarker detectAsyncImage:image timestampInMilliseconds:0 error:&error]);
|
||||
|
||||
NSError *expectedError =
|
||||
[NSError errorWithDomain:kExpectedErrorDomain
|
||||
|
@ -533,7 +533,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
for (int i = 0; i < iterationCount; i++) {
|
||||
XCTAssertTrue([handLandmarker detectAsyncInImage:image timestampInMilliseconds:i error:nil]);
|
||||
XCTAssertTrue([handLandmarker detectAsyncImage:image timestampInMilliseconds:i error:nil]);
|
||||
}
|
||||
|
||||
NSTimeInterval timeout = 0.5f;
|
||||
|
|
|
@ -146,7 +146,7 @@ NS_SWIFT_NAME(HandLandmarker)
|
|||
* @return An `HandLandmarkerResult` object that contains the hand hand landmarks detection
|
||||
* results.
|
||||
*/
|
||||
- (nullable MPPHandLandmarkerResult *)detectInImage:(MPPImage *)image
|
||||
- (nullable MPPHandLandmarkerResult *)detectImage:(MPPImage *)image
|
||||
error:(NSError **)error NS_SWIFT_NAME(detect(image:));
|
||||
|
||||
/**
|
||||
|
@ -176,7 +176,7 @@ NS_SWIFT_NAME(HandLandmarker)
|
|||
* @return An `HandLandmarkerResult` object that contains the hand hand landmarks detection
|
||||
* results.
|
||||
*/
|
||||
- (nullable MPPHandLandmarkerResult *)detectInVideoFrame:(MPPImage *)image
|
||||
- (nullable MPPHandLandmarkerResult *)detectVideoFrame:(MPPImage *)image
|
||||
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
|
||||
error:(NSError **)error
|
||||
NS_SWIFT_NAME(detect(videoFrame:timestampInMilliseconds:));
|
||||
|
@ -216,7 +216,7 @@ NS_SWIFT_NAME(HandLandmarker)
|
|||
*
|
||||
* @return `YES` if the image was sent to the task successfully, otherwise `NO`.
|
||||
*/
|
||||
- (BOOL)detectAsyncInImage:(MPPImage *)image
|
||||
- (BOOL)detectAsyncImage:(MPPImage *)image
|
||||
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
|
||||
error:(NSError **)error
|
||||
NS_SWIFT_NAME(detectAsync(image:timestampInMilliseconds:));
|
||||
|
|
|
@ -140,13 +140,13 @@ static NSString *const kTaskName = @"handLandmarker";
|
|||
return [self initWithOptions:options error:error];
|
||||
}
|
||||
|
||||
- (nullable MPPHandLandmarkerResult *)detectInImage:(MPPImage *)image error:(NSError **)error {
|
||||
- (nullable MPPHandLandmarkerResult *)detectImage:(MPPImage *)image error:(NSError **)error {
|
||||
std::optional<PacketMap> outputPacketMap = [_visionTaskRunner processImage:image error:error];
|
||||
|
||||
return [MPPHandLandmarker handLandmarkerResultWithOptionalOutputPacketMap:outputPacketMap];
|
||||
}
|
||||
|
||||
- (nullable MPPHandLandmarkerResult *)detectInVideoFrame:(MPPImage *)image
|
||||
- (nullable MPPHandLandmarkerResult *)detectVideoFrame:(MPPImage *)image
|
||||
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
|
||||
error:(NSError **)error {
|
||||
std::optional<PacketMap> outputPacketMap =
|
||||
|
@ -157,7 +157,7 @@ static NSString *const kTaskName = @"handLandmarker";
|
|||
return [MPPHandLandmarker handLandmarkerResultWithOptionalOutputPacketMap:outputPacketMap];
|
||||
}
|
||||
|
||||
- (BOOL)detectAsyncInImage:(MPPImage *)image
|
||||
- (BOOL)detectAsyncImage:(MPPImage *)image
|
||||
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
|
||||
error:(NSError **)error {
|
||||
return [_visionTaskRunner processLiveStreamImage:image
|
||||
|
|
Loading…
Reference in New Issue
Block a user