Updated face detector to use new methods from vision task runner

This commit is contained in:
Prianka Liz Kariat 2023-05-26 18:49:24 +05:30
parent 6fabc35ce7
commit 23d97292a6

View File

@ -128,10 +128,8 @@ static NSString *const kTaskName = @"faceDetector";
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;
@ -154,10 +152,8 @@ static NSString *const kTaskName = @"faceDetector";
- (nullable MPPFaceDetectorResult *)detectInImage:(MPPImage *)image error:(NSError **)error { - (nullable MPPFaceDetectorResult *)detectInImage:(MPPImage *)image 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 nil; return nil;