I would like to read Japanese characters from a scanned image using swift's Vision framework. However, when I attempt to set the recognition language of VNRecognizeTextRequest
to Japanese using
request.recognitionLanguages = ["ja", "en"]
the output of my program becomes nonsensical roman letters. For each image of japanese text there is unexpected recognized text output. However, when set to other languages such as Chinese or German the text output is as expected. What could be causing the unexpected output seemingly peculiar to Japanese?
I am building from the github project here.
CodePudding user response:
As they said in WWDC 2019 video, Text Recognition in Vision Framework:
First, a prerequisite, you need to check the languages that are supported by language-based correction...
Look at supportedRecognitionLanguages
for VNRecognizeTextRequestRevision2
for “accurate” recognition, and it would appear that the supported languages are:
["en-US", "fr-FR", "it-IT", "de-DE", "es-ES", "pt-BR", "zh-Hans", "zh-Hant"]
If you use “fast” recognition, the list is shorter:
["en-US", "fr-FR", "it-IT", "de-DE", "es-ES", "pt-BR"]
And if you fall back to VNRecognizeTextRequestRevision1
, it is even shorter (lol):
["en-US"]
It would appear that Japanese is not a supported language at this point.