Updated formatting

This commit is contained in:
Prianka Liz Kariat 2023-05-04 01:02:47 +05:30
parent 4401b11c3a
commit 37e14a7cad
2 changed files with 21 additions and 21 deletions

View File

@ -86,7 +86,8 @@ static NSString *const kTaskName = @"objectDetector";
// Capturing `self` as weak in order to avoid `self` being kept in memory // Capturing `self` as weak in order to avoid `self` being kept in memory
// and cause a retain cycle, after self is set to `nil`. // and cause a retain cycle, after self is set to `nil`.
MPPObjectDetector *__weak weakSelf = self; 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<PacketMap> statusOrPackets) { packetsCallback = [=](absl::StatusOr<PacketMap> statusOrPackets) {
if (!weakSelf) { if (!weakSelf) {
return; return;
@ -117,13 +118,11 @@ static NSString *const kTaskName = @"objectDetector";
objectDetectionResultWithDetectionsPacket:statusOrPackets.value()[kDetectionsStreamName objectDetectionResultWithDetectionsPacket:statusOrPackets.value()[kDetectionsStreamName
.cppString]]; .cppString]];
NSInteger timeStampInMilliseconds = outputPacketMap[kImageOutStreamName.cppString] NSInteger timeStampInMilliseconds =
.Timestamp() outputPacketMap[kImageOutStreamName.cppString].Timestamp().Value() /
.Value() /
kMicroSecondsPerMilliSecond; kMicroSecondsPerMilliSecond;
dispatch_async(callbackQueue, ^{ dispatch_async(callbackQueue, ^{
[weakSelf.objectDetectorDelegate [weakSelf.objectDetectorDelegate objectDetector:weakSelf
objectDetector:weakSelf
didFinishDetectionWithResult:result didFinishDetectionWithResult:result
timestampInMilliseconds:timeStampInMilliseconds timestampInMilliseconds:timeStampInMilliseconds
error:callbackError]; error:callbackError];

View File

@ -44,13 +44,14 @@ NS_SWIFT_NAME(ObjectDetectorDelegate)
* *
* @param objectDetector The object detector which performed the object detection. * @param objectDetector The object detector which performed the object detection.
* This is useful to test equality when there are multiple instances of `MPPObjectDetector`. * 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 * @param result The `MPPObjectDetectionResult` object that contains a list of detections, each
* has a bounding box that is expressed in the unrotated input frame of reference coordinates * detection has a bounding box that is expressed in the unrotated input frame of reference
* system, i.e. in `[0,image_width) x [0,image_height)`, which are the dimensions of the underlying * coordinates system, i.e. in `[0,image_width) x [0,image_height)`, which are the dimensions of the
* image data. * underlying image data.
* @param timestampInMilliseconds The timestamp (in milliseconds) which indicates when the input * @param timestampInMilliseconds The timestamp (in milliseconds) which indicates when the input
* image was sent to the object detector. * 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 - (void)objectDetector:(MPPObjectDetector *)objectDetector