From 22dc08be0ea5cfacdc60292c0873382a91343d63 Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Thu, 17 Aug 2023 14:15:14 +0530 Subject: [PATCH] Removed convenience initializer from refactored MPPVisionTaskRunner --- .../sources/MPPVisionTaskRunnerRefactored.mm | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunnerRefactored.mm b/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunnerRefactored.mm index efc2bf282..5852d9e7d 100644 --- a/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunnerRefactored.mm +++ b/mediapipe/tasks/ios/vision/core/sources/MPPVisionTaskRunnerRefactored.mm @@ -59,10 +59,17 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision"; @implementation MPPVisionTaskRunner -- (nullable instancetype)initWithCalculatorGraphConfig:(CalculatorGraphConfig)graphConfig - runningMode:(MPPRunningMode)runningMode - packetsCallback:(PacketsCallback)packetsCallback - error:(NSError **)error { +- (nullable instancetype)initWithTaskInfo:(MPPTaskInfo *)taskInfo + runningMode:(MPPRunningMode)runningMode + roiAllowed:(BOOL)roiAllowed + packetsCallback:(PacketsCallback)packetsCallback + imageInputStreamName:(NSString *)imageInputStreamName + normRectInputStreamName:(NSString *)normRectInputStreamName + error:(NSError **)error { + _roiAllowed = roiAllowed; + _imageInStreamName = imageInputStreamName.cppString; + _normRectInStreamName = normRectInputStreamName.cppString; + switch (runningMode) { case MPPRunningModeImage: case MPPRunningModeVideo: { @@ -97,28 +104,12 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision"; } _runningMode = runningMode; - self = [super initWithCalculatorGraphConfig:graphConfig + self = [super initWithCalculatorGraphConfig: [taskInfo generateGraphConfig] packetsCallback:packetsCallback error:error]; return self; } -- (nullable instancetype)initWithTaskInfo:(MPPTaskInfo *)taskInfo - runningMode:(MPPRunningMode)runningMode - roiAllowed:(BOOL)roiAllowed - packetsCallback:(PacketsCallback)packetsCallback - imageInputStreamName:(NSString *)imageInputStreamName - normRectInputStreamName:(NSString *)normRectInputStreamName - error:(NSError **)error { - _roiAllowed = roiAllowed; - _imageInStreamName = imageInputStreamName.cppString; - _normRectInStreamName = normRectInputStreamName.cppString; - - return [self initWithCalculatorGraphConfig:[taskInfo generateGraphConfig] - packetsCallback:packetsCallback - error:error]; -} - - (std::optional)normalizedRectWithRegionOfInterest:(CGRect)roi imageSize:(CGSize)imageSize imageOrientation: