I'm using the UIText recognition with the .accurate recognition type and it keeps reading the text flipped
for eg. instead of scanning 0606 it scans it as 9090
This is the piece of code
func setUpVisionTextRecognizingImage(image: UIImage){
var textString = ""
request = VNRecognizeTextRequest(completionHandler: {(request, error) in
guard let observations = request.results as?[VNRecognizedTextObservation] else {fatalError("Recieved Invalid Observaton")}
for observation in observations {
guard let topCandidate = observation.topCandidates(1).first else {print("No Candidate")
continue
}
textString = "
(topCandidate.string)"
print(textString)
DispatchQueue.main.async {
self.stopAnimating()
let (testingVariable, isItFound) = (self.brain.getCode(uneditedCode: textString))
if isItFound == true {
self.textLabel.text = testingVariable
self.buttonPressed(self)
}
else{self.showTryAgain(message: "try again")}
}}})
request.recognitionLevel = .accurate
let requests = [request]
DispatchQueue.global(qos: .userInitiated).async {
guard let img = image.cgImage else{fatalError("Missing Image to Scan")}
let handle = VNImageRequestHandler(cgImage: img, options: [:])
try?handle.perform(requests)
}
}
question from:
https://stackoverflow.com/questions/65886500/uitextrecognition-getting-the-text-upside-down-swift 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…