draw vision barcodes

Hi, I have seen this video: https://developer.apple.com/videos/play/wwdc2021/10041/

and in my project i am trying to draw detected barcodes. I am using Vision framework and i have the barcode position in boundingBox parameter, but i dont understand cgrect of that parameter.

I am programming in objective c and i don't see resources, and for more complication i have not an image, i am capturing barcodes from video camera sesion.

for parts: 1-how can i draw detected barcode like in the video (from an image). 2-how can i draw detected barcode in capturesession.

I have used VNImageRectForNormalizedRect to pass from normalized to pixel, but the result is not correct.

thank you very much.

Replies

You can take a look at this article, I hope it can help you.

Barcode detection using Vision framework

https://cornerbit.tech/barcode-detection-using-vision-framework/


Some screenshots of the article:

Post not yet marked as solved Up vote reply of Aric Down vote reply of Aric

Thank you very much. Is any information about how to translate from vision bounding box cgrect to UIKit coordinate space in objective c? I didn't found any page with information. In the tutorial that you attach there are some function en swift that i can't translate to objective c.

This one: let rectangles = boxesAndPayload.map { $0.box } .map { CGRect(origin: $0.origin.translateFromCoreImageToUIKitCoordinateSpace(using: image.size.height), size: $0.size) }

Thank you for your time