apple-vision

Bounding Box from VNDetectRectangleRequest is not correct size when used as child VC

帅比萌擦擦* 提交于 2021-02-15 07:08:28
问题 I am trying to use VNDetectRectangleRequest from Apple's Vision framework to automatically grab a picture of a card. However when I convert the points to draw the rectangle, it is misshapen and does not follow the rectangle is it should. I have been following this article pretty closely One major difference is I am embedding my CameraCaptureVC in another ViewController so that the card will be scanned only when it is in this smaller window. Below is how I set up the camera vc in the parent vc

Bounding Box from VNDetectRectangleRequest is not correct size when used as child VC

夙愿已清 提交于 2021-02-15 07:05:26
问题 I am trying to use VNDetectRectangleRequest from Apple's Vision framework to automatically grab a picture of a card. However when I convert the points to draw the rectangle, it is misshapen and does not follow the rectangle is it should. I have been following this article pretty closely One major difference is I am embedding my CameraCaptureVC in another ViewController so that the card will be scanned only when it is in this smaller window. Below is how I set up the camera vc in the parent vc

Swiftui getting an image's displaying dimensions

回眸只為那壹抹淺笑 提交于 2021-02-08 05:12:11
问题 I'm trying to get the dimensions of a displayed image to draw bounding boxes over the text I have recognized using apple's Vision framework. So I run the VNRecognizeTextRequest uppon the press of a button with this funcion func readImage(image:NSImage, completionHandler:@escaping(([VNRecognizedText]?,Error?)->()), comp:@escaping((Double?,Error?)->())) { var recognizedTexts = [VNRecognizedText]() var rr = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height) let requestHandler

Swiftui getting an image's displaying dimensions

荒凉一梦 提交于 2021-02-08 05:12:10
问题 I'm trying to get the dimensions of a displayed image to draw bounding boxes over the text I have recognized using apple's Vision framework. So I run the VNRecognizeTextRequest uppon the press of a button with this funcion func readImage(image:NSImage, completionHandler:@escaping(([VNRecognizedText]?,Error?)->()), comp:@escaping((Double?,Error?)->())) { var recognizedTexts = [VNRecognizedText]() var rr = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height) let requestHandler

Apple Vision framework – Text extraction from image

好久不见. 提交于 2020-05-09 18:32:27
问题 I am using Vision framework for iOS 11 to detect text on image. The texts are getting detected successfully, but how we can get the detected text? 回答1: Not exactly a dupe but similar to: Converting a Vision VNTextObservation to a String You need to either use CoreML or another library to perform OCR (SwiftOCR, etc.) 回答2: In Apple Vision you can easily extract text from image using VNRecognizeTextRequest class, allowing you to make an image analysis request that finds and recognizes text in an

VNDetectTextRectanglesRequest Not Working For Less Than 3 Digits

不问归期 提交于 2020-01-06 07:12:55
问题 I'm experimenting with Apple's Vision framework to detect the location of characters (letters, numbers, etc). Why can't I get the VisionBasics demo project to detect text in images with less than 3 digits? I've already tried binarizing the image by reducing saturation and increasing contrast. I even tried inverting the black and white portions, but it didn't improve the results. The 2-digit images are approximately 28x24 pixels. Link to Xcode Project: https://docs-assets.developer.apple.com

Merge images using “VNImageHomographicAlignmentObservation” class

ぃ、小莉子 提交于 2019-12-21 21:34:59
问题 I am trying to merge two images using VNImageHomographicAlignmentObservation , I am currently getting a 3d matrix that looks like this: simd_float3x3([ [0.99229, -0.00451023, -4.32607e-07)], [0.00431724,0.993118, 2.38839e-07)], [-72.2425, -67.9966, 0.999288)]], ) But I don't know how to use these values to merge into one image. There doesn't seem to be any documentation on what these values even mean. I found some information on transformation matrices here: Working with matrices. But so far

VNFaceObservation BoundingBox Not Scaling In Portrait Mode

老子叫甜甜 提交于 2019-12-12 05:59:43
问题 For reference, this stems from a question in the Vision API . I am working to use Vision to detect faces in an image via a VNDetectFaceRectanglesRequest , which is successfully functioning in terms of determining the correct number of faces in an image and providing the boundingBox for each face. My trouble is that due to my UIImageView (which holds the UIImage in question) is using a .scaleAspectFit content mode, I am having immense difficulty in properly drawing the bounding box in portrait

Vision, VNDetectTextRectanglesRequest - can't recognize single number as region

妖精的绣舞 提交于 2019-12-05 00:07:53
问题 I want to use VNDetectTextRectanglesRequest from a Vision framework to detect regions in an image containing only one character, number '9', with the white background. I'm using following code to do this: private func performTextDetection() { let textRequest = VNDetectTextRectanglesRequest(completionHandler: self.detectTextHandler) textRequest.reportCharacterBoxes = true textRequest.preferBackgroundProcessing = false let handler = VNImageRequestHandler(cgImage: loadedImage.cgImage!, options:

Merge images using “VNImageHomographicAlignmentObservation” class

给你一囗甜甜゛ 提交于 2019-12-04 16:26:23
I am trying to merge two images using VNImageHomographicAlignmentObservation , I am currently getting a 3d matrix that looks like this: simd_float3x3([ [0.99229, -0.00451023, -4.32607e-07)], [0.00431724,0.993118, 2.38839e-07)], [-72.2425, -67.9966, 0.999288)]], ) But I don't know how to use these values to merge into one image. There doesn't seem to be any documentation on what these values even mean. I found some information on transformation matrices here: Working with matrices . But so far nothing else has helped me... Any suggestions? My Code: func setup() { let floatingImage = UIImage