I'm using VNRecognizeTextRequest
via VNImageRequestHandler
with following settings:
request.recognitionLevel = .accurate
request.usesLanguageCorrection = false
request.recognitionLanguages = ["en-US", "de-DE"]
I'm using real time capturing from AVFoundation
, then converting CMSampleBuffer
to CVPixelBuffer
and send it to VNImageRequestHandler
.
Basically the code is taken from Apple sample: https://developer.apple.com/documentation/vision/reading_phone_numbers_in_real_time
The thing is it was working well until iOS 15 came. Then it stopped recognising the text with following errors:
Could not determine an appropriate width index for aspect ratio 0.0062
Could not determine an appropriate width index for aspect ratio 0.0078
Could not determine an appropriate width index for aspect ratio 0.0089
...
Generally I was able to partly fix it by changing recognitionLevel
from .accurate
to .fast
. But I prefer the first more as it gives better results and sometimes .fast
recognises only individual characters from words, e.g. if there is a number with spaces like "7 2 5 6"
it can recognise only 7 or 2 and so on.
Thanks in advance for suggestions.