4 ms·
The most interesting piece of code here IMO is the recognize() method, which demonstrates how to call Vision.VNImageRequestHandler and Vision.VNRecognizeTextReq
by simonw 3y ago
The most interesting piece of code here IMO is the recognize() method, which demonstrates how to call Vision.VNImageRequestHandler and Vision.VNRecognizeTextRequest from Python code using pyobjc.
https://github.com/louisbrulenaudet/apple-ocr/blob/70c25b24bf218d4299275700229d335f79c80cba/apple_ocr/ocr.py#L208-L272 https://github.com/louisbrulenaudet/apple-ocr/blob/70c25b24b...
- wahnfrieden 3y agoNote that Vision.VNRecognizeTextRequest is old tech that is less accurate than the newer ImageAnalyzer API from Apple. These tools use Vision.VNRecognizeTextRequest because of legacy tech reasons - new APIs from Apple tend to be Swift-exclusive, while these tools are only built for ObjC Choosing Vision.VNRecognizeTextRequest is choosing less accuracy than is currently available on the same platform
- thrdbndndn 3y agoSorry for my ignorance, but how does it work? I understand that Vision is an Apple framework, but does it mean that if you are on MacOS, you can just call `import Vision` and it just works? No need to install any package/library as a wrapper? Didn't see anything special in setup.cfg or readme about the setup.
- sroussey 3y agoiOS too https://developer.apple.com/documentation/vision/vnrecognizetextrequest https://developer.apple.com/documentation/vision/vnrecognize...
- saagarjha 3y agoPyObjC is shipped by Apple, yes. (It even used to be installed by default.)
- thrdbndndn 3y ago> PyObjC Ah, thanks, I totally overlooked this. This is what brings all the Apple's Objective C API to Python.
- pjmlp 3y ago1 - install_requires in setup.y adds dependency to pyobjc 2 - which brings the Vision package along, https://pyobjc.readthedocs.io/en/latest/apinotes/Vision.html https://pyobjc.readthedocs.io/en/latest/apinotes/Vision.html