Updated iOS vision tasks to use new methods from vision task runner

This commit is contained in:
Prianka Liz Kariat 2023-05-24 19:17:20 +05:30
parent 164eae8c16
commit 117bb507e6
2 changed files with 10 additions and 16 deletions

View File

@ -166,10 +166,9 @@ static const int kMicroSecondsPerMilliSecond = 1000;
regionOfInterest:(CGRect)roi
error:(NSError **)error {
std::optional<NormalizedRect> rect =
[_visionTaskRunner normalizedRectFromRegionOfInterest:roi
imageSize:CGSizeMake(image.width, image.height)
[_visionTaskRunner normalizedRectWithRegionOfInterest:roi
imageOrientation:image.orientation
ROIAllowed:YES
imageSize:CGSizeMake(image.width, image.height)
error:error];
if (!rect.has_value()) {
return nil;
@ -196,15 +195,18 @@ static const int kMicroSecondsPerMilliSecond = 1000;
outputPacketMap.value()[kClassificationsStreamName.cppString]];
}
- (nullable MPPImageClassifierResult *)classifyImage:(MPPImage *)image error:(NSError **)error {
return [self classifyImage:image regionOfInterest:CGRectZero error:error];
}
- (std::optional<PacketMap>)inputPacketMapWithMPPImage:(MPPImage *)image
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
regionOfInterest:(CGRect)roi
error:(NSError **)error {
std::optional<NormalizedRect> rect =
[_visionTaskRunner normalizedRectFromRegionOfInterest:roi
imageSize:CGSizeMake(image.width, image.height)
[_visionTaskRunner normalizedRectWithRegionOfInterest:roi
imageOrientation:image.orientation
ROIAllowed:YES
imageSize:CGSizeMake(image.width, image.height)
error:error];
if (!rect.has_value()) {
return std::nullopt;
@ -225,10 +227,6 @@ static const int kMicroSecondsPerMilliSecond = 1000;
return inputPacketMap;
}
- (nullable MPPImageClassifierResult *)classifyImage:(MPPImage *)image error:(NSError **)error {
return [self classifyImage:image regionOfInterest:CGRectZero error:error];
}
- (nullable MPPImageClassifierResult *)classifyVideoFrame:(MPPImage *)image
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
regionOfInterest:(CGRect)roi

View File

@ -160,10 +160,8 @@ static NSString *const kTaskName = @"objectDetector";
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
error:(NSError **)error {
std::optional<NormalizedRect> rect =
[_visionTaskRunner normalizedRectFromRegionOfInterest:CGRectZero
[_visionTaskRunner normalizedRectWithImageOrientation:image.orientation
imageSize:CGSizeMake(image.width, image.height)
imageOrientation:image.orientation
ROIAllowed:NO
error:error];
if (!rect.has_value()) {
return std::nullopt;
@ -188,10 +186,8 @@ static NSString *const kTaskName = @"objectDetector";
regionOfInterest:(CGRect)roi
error:(NSError **)error {
std::optional<NormalizedRect> rect =
[_visionTaskRunner normalizedRectFromRegionOfInterest:roi
[_visionTaskRunner normalizedRectWithImageOrientation:image.orientation
imageSize:CGSizeMake(image.width, image.height)
imageOrientation:image.orientation
ROIAllowed:NO
error:error];
if (!rect.has_value()) {
return nil;