Removed convenience initializer from refactored MPPVisionTaskRunner

This commit is contained in:
Prianka Liz Kariat 2023-08-17 14:15:14 +05:30
parent d2a86341bd
commit 22dc08be0e

View File

@ -59,10 +59,17 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision";
@implementation MPPVisionTaskRunner @implementation MPPVisionTaskRunner
- (nullable instancetype)initWithCalculatorGraphConfig:(CalculatorGraphConfig)graphConfig - (nullable instancetype)initWithTaskInfo:(MPPTaskInfo *)taskInfo
runningMode:(MPPRunningMode)runningMode runningMode:(MPPRunningMode)runningMode
packetsCallback:(PacketsCallback)packetsCallback roiAllowed:(BOOL)roiAllowed
error:(NSError **)error { packetsCallback:(PacketsCallback)packetsCallback
imageInputStreamName:(NSString *)imageInputStreamName
normRectInputStreamName:(NSString *)normRectInputStreamName
error:(NSError **)error {
_roiAllowed = roiAllowed;
_imageInStreamName = imageInputStreamName.cppString;
_normRectInStreamName = normRectInputStreamName.cppString;
switch (runningMode) { switch (runningMode) {
case MPPRunningModeImage: case MPPRunningModeImage:
case MPPRunningModeVideo: { case MPPRunningModeVideo: {
@ -97,28 +104,12 @@ static NSString *const kTaskPrefix = @"com.mediapipe.tasks.vision";
} }
_runningMode = runningMode; _runningMode = runningMode;
self = [super initWithCalculatorGraphConfig:graphConfig self = [super initWithCalculatorGraphConfig: [taskInfo generateGraphConfig]
packetsCallback:packetsCallback packetsCallback:packetsCallback
error:error]; error:error];
return self; 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<NormalizedRect>)normalizedRectWithRegionOfInterest:(CGRect)roi - (std::optional<NormalizedRect>)normalizedRectWithRegionOfInterest:(CGRect)roi
imageSize:(CGSize)imageSize imageSize:(CGSize)imageSize
imageOrientation: imageOrientation: