Updated iOS vision tasks to use new methods from vision task runner
This commit is contained in:
		
							parent
							
								
									164eae8c16
								
							
						
					
					
						commit
						117bb507e6
					
				| 
						 | 
					@ -166,10 +166,9 @@ static const int kMicroSecondsPerMilliSecond = 1000;
 | 
				
			||||||
                                    regionOfInterest:(CGRect)roi
 | 
					                                    regionOfInterest:(CGRect)roi
 | 
				
			||||||
                                               error:(NSError **)error {
 | 
					                                               error:(NSError **)error {
 | 
				
			||||||
  std::optional<NormalizedRect> rect =
 | 
					  std::optional<NormalizedRect> rect =
 | 
				
			||||||
      [_visionTaskRunner normalizedRectFromRegionOfInterest:roi
 | 
					      [_visionTaskRunner normalizedRectWithRegionOfInterest:roi
 | 
				
			||||||
                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
					 | 
				
			||||||
                                           imageOrientation:image.orientation
 | 
					                                           imageOrientation:image.orientation
 | 
				
			||||||
                                                 ROIAllowed:YES
 | 
					                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
				
			||||||
                                                      error:error];
 | 
					                                                      error:error];
 | 
				
			||||||
  if (!rect.has_value()) {
 | 
					  if (!rect.has_value()) {
 | 
				
			||||||
    return nil;
 | 
					    return nil;
 | 
				
			||||||
| 
						 | 
					@ -196,15 +195,18 @@ static const int kMicroSecondsPerMilliSecond = 1000;
 | 
				
			||||||
                                    outputPacketMap.value()[kClassificationsStreamName.cppString]];
 | 
					                                    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
 | 
					- (std::optional<PacketMap>)inputPacketMapWithMPPImage:(MPPImage *)image
 | 
				
			||||||
                               timestampInMilliseconds:(NSInteger)timestampInMilliseconds
 | 
					                               timestampInMilliseconds:(NSInteger)timestampInMilliseconds
 | 
				
			||||||
                                      regionOfInterest:(CGRect)roi
 | 
					                                      regionOfInterest:(CGRect)roi
 | 
				
			||||||
                                                 error:(NSError **)error {
 | 
					                                                 error:(NSError **)error {
 | 
				
			||||||
  std::optional<NormalizedRect> rect =
 | 
					  std::optional<NormalizedRect> rect =
 | 
				
			||||||
      [_visionTaskRunner normalizedRectFromRegionOfInterest:roi
 | 
					      [_visionTaskRunner normalizedRectWithRegionOfInterest:roi
 | 
				
			||||||
                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
					 | 
				
			||||||
                                           imageOrientation:image.orientation
 | 
					                                           imageOrientation:image.orientation
 | 
				
			||||||
                                                 ROIAllowed:YES
 | 
					                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
				
			||||||
                                                      error:error];
 | 
					                                                      error:error];
 | 
				
			||||||
  if (!rect.has_value()) {
 | 
					  if (!rect.has_value()) {
 | 
				
			||||||
    return std::nullopt;
 | 
					    return std::nullopt;
 | 
				
			||||||
| 
						 | 
					@ -225,10 +227,6 @@ static const int kMicroSecondsPerMilliSecond = 1000;
 | 
				
			||||||
  return inputPacketMap;
 | 
					  return inputPacketMap;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (nullable MPPImageClassifierResult *)classifyImage:(MPPImage *)image error:(NSError **)error {
 | 
					 | 
				
			||||||
  return [self classifyImage:image regionOfInterest:CGRectZero error:error];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- (nullable MPPImageClassifierResult *)classifyVideoFrame:(MPPImage *)image
 | 
					- (nullable MPPImageClassifierResult *)classifyVideoFrame:(MPPImage *)image
 | 
				
			||||||
                                  timestampInMilliseconds:(NSInteger)timestampInMilliseconds
 | 
					                                  timestampInMilliseconds:(NSInteger)timestampInMilliseconds
 | 
				
			||||||
                                         regionOfInterest:(CGRect)roi
 | 
					                                         regionOfInterest:(CGRect)roi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,10 +160,8 @@ static NSString *const kTaskName = @"objectDetector";
 | 
				
			||||||
                               timestampInMilliseconds:(NSInteger)timestampInMilliseconds
 | 
					                               timestampInMilliseconds:(NSInteger)timestampInMilliseconds
 | 
				
			||||||
                                                 error:(NSError **)error {
 | 
					                                                 error:(NSError **)error {
 | 
				
			||||||
  std::optional<NormalizedRect> rect =
 | 
					  std::optional<NormalizedRect> rect =
 | 
				
			||||||
      [_visionTaskRunner normalizedRectFromRegionOfInterest:CGRectZero
 | 
					      [_visionTaskRunner normalizedRectWithImageOrientation:image.orientation
 | 
				
			||||||
                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
					                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
				
			||||||
                                           imageOrientation:image.orientation
 | 
					 | 
				
			||||||
                                                 ROIAllowed:NO
 | 
					 | 
				
			||||||
                                                      error:error];
 | 
					                                                      error:error];
 | 
				
			||||||
  if (!rect.has_value()) {
 | 
					  if (!rect.has_value()) {
 | 
				
			||||||
    return std::nullopt;
 | 
					    return std::nullopt;
 | 
				
			||||||
| 
						 | 
					@ -188,10 +186,8 @@ static NSString *const kTaskName = @"objectDetector";
 | 
				
			||||||
                                   regionOfInterest:(CGRect)roi
 | 
					                                   regionOfInterest:(CGRect)roi
 | 
				
			||||||
                                              error:(NSError **)error {
 | 
					                                              error:(NSError **)error {
 | 
				
			||||||
  std::optional<NormalizedRect> rect =
 | 
					  std::optional<NormalizedRect> rect =
 | 
				
			||||||
      [_visionTaskRunner normalizedRectFromRegionOfInterest:roi
 | 
					      [_visionTaskRunner normalizedRectWithImageOrientation:image.orientation
 | 
				
			||||||
                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
					                                                  imageSize:CGSizeMake(image.width, image.height)
 | 
				
			||||||
                                           imageOrientation:image.orientation
 | 
					 | 
				
			||||||
                                                 ROIAllowed:NO
 | 
					 | 
				
			||||||
                                                      error:error];
 | 
					                                                      error:error];
 | 
				
			||||||
  if (!rect.has_value()) {
 | 
					  if (!rect.has_value()) {
 | 
				
			||||||
    return nil;
 | 
					    return nil;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user