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
- (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<NormalizedRect>)normalizedRectWithRegionOfInterest:(CGRect)roi
imageSize:(CGSize)imageSize
imageOrientation: