diff --git a/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm b/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm index 6d02710a7..c384dd4b7 100644 --- a/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm +++ b/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetector.mm @@ -86,7 +86,8 @@ static NSString *const kTaskName = @"objectDetector"; // Capturing `self` as weak in order to avoid `self` being kept in memory // and cause a retain cycle, after self is set to `nil`. MPPObjectDetector *__weak weakSelf = self; - dispatch_queue_t callbackQueue = dispatch_queue_create([MPPVisionTaskRunner uniqueQueueNameWithTaskName:kTaskName], NULL); + dispatch_queue_t callbackQueue = + dispatch_queue_create([MPPVisionTaskRunner uniqueQueueNameWithTaskName:kTaskName], NULL); packetsCallback = [=](absl::StatusOr statusOrPackets) { if (!weakSelf) { return; @@ -101,9 +102,9 @@ static NSString *const kTaskName = @"objectDetector"; if (![MPPCommonUtils checkCppError:statusOrPackets.status() toError:&callbackError]) { dispatch_async(callbackQueue, ^{ [weakSelf.objectDetectorDelegate objectDetector:weakSelf - didFinishDetectionWithResult:nil - timestampInMilliseconds:Timestamp::Unset().Value() - error:callbackError]; + didFinishDetectionWithResult:nil + timestampInMilliseconds:Timestamp::Unset().Value() + error:callbackError]; }); return; } @@ -116,17 +117,15 @@ static NSString *const kTaskName = @"objectDetector"; MPPObjectDetectionResult *result = [MPPObjectDetectionResult objectDetectionResultWithDetectionsPacket:statusOrPackets.value()[kDetectionsStreamName .cppString]]; - - NSInteger timeStampInMilliseconds = outputPacketMap[kImageOutStreamName.cppString] - .Timestamp() - .Value() / - kMicroSecondsPerMilliSecond; + + NSInteger timeStampInMilliseconds = + outputPacketMap[kImageOutStreamName.cppString].Timestamp().Value() / + kMicroSecondsPerMilliSecond; dispatch_async(callbackQueue, ^{ - [weakSelf.objectDetectorDelegate - objectDetector:weakSelf - didFinishDetectionWithResult:result - timestampInMilliseconds:timeStampInMilliseconds - error:callbackError]; + [weakSelf.objectDetectorDelegate objectDetector:weakSelf + didFinishDetectionWithResult:result + timestampInMilliseconds:timeStampInMilliseconds + error:callbackError]; }); }; } diff --git a/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetectorOptions.h b/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetectorOptions.h index 35eb1e91a..547fd5ed0 100644 --- a/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetectorOptions.h +++ b/mediapipe/tasks/ios/vision/object_detector/sources/MPPObjectDetectorOptions.h @@ -38,19 +38,20 @@ NS_SWIFT_NAME(ObjectDetectorDelegate) /** * This method notifies a delegate that the results of asynchronous object detection of * an image submitted to the `MPPObjectDetector` is available. - * + * * This method is called on a private serial dispatch queue created by the `MPPObjectDetector` * for performing the asynchronous delegates calls. * * @param objectDetector The object detector which performed the object detection. - * This is useful to test equality when there are multiple instances of `MPPObjectDetector`. - * @param result The `MPPObjectDetectionResult` object that contains a list of detections, each detection - * has a bounding box that is expressed in the unrotated input frame of reference coordinates - * system, i.e. in `[0,image_width) x [0,image_height)`, which are the dimensions of the underlying - * image data. + * This is useful to test equality when there are multiple instances of `MPPObjectDetector`. + * @param result The `MPPObjectDetectionResult` object that contains a list of detections, each + * detection has a bounding box that is expressed in the unrotated input frame of reference + * coordinates system, i.e. in `[0,image_width) x [0,image_height)`, which are the dimensions of the + * underlying image data. * @param timestampInMilliseconds The timestamp (in milliseconds) which indicates when the input * image was sent to the object detector. - * @param error An optional error parameter populated when there is an error in performing object detection on the input live stream image data. + * @param error An optional error parameter populated when there is an error in performing object + * detection on the input live stream image data. * */ - (void)objectDetector:(MPPObjectDetector *)objectDetector