Closed sumi-svmx closed 11 months ago
@mrousavy Thanks for the response
vga-640x480
with MLKit/TextRecognition
2.2.0
- doesn't work. Seems to work with vga-640x480
preset in MLKit/TextRecognition
3.0.0
. But it's quite a low quality on the camera, and many texts get recognized wrong. So as a workaround used this instead, which isn't ideallet imageBuffer = CMSampleBufferGetImageBuffer(frame.buffer)!
let ciimage = CIImage(cvPixelBuffer: imageBuffer)
let context = CIContext(options: nil)
let cgImage = context.createCGImage(ciimage, from: ciimage.extent)!
let image = UIImage(cgImage: cgImage)
let visionImage = VisionImage(image: image)
visionImage.orientation = .up
...
result = try TextRecognizer.textRecognizer()
.results(in: visionImage)
@sumi-svmx hey, I have the same issue (but with object detector), did you solve yours?
My code looks very similar, but I'm getting the image object slightly different, what is the reason to use CIImage
as proxy?
@objc
public static func callback(_ frame: Frame!, withArgs _: [Any]!) -> Any! {
let image = VisionImage(buffer: frame.buffer)
image.orientation = .upMirrored
do {
let objects : [Object] = try detector.results(in: image)
if (objects.isEmpty) {
print("can not find object")
return nil
}
...
Can confirm this solved my problem with getting MLKit/TextRecognition 3.1.0 to work. Thanks @sumi-svmx!
Hey - I created a new fast JSI library for this that is written in C++ and uses GPU acceleration: https://github.com/mrousavy/react-native-fast-tflite 🥳
this issue resolve yet :-?
What were you trying to do?
Had tried this with vision-camera-ocr using GoogleMLKit/TextRecognition 2.2.0
Does not seem to recognize text with the frame buffer. Made the following changes as a fix (not ideal). Wondering if there could be a fix to this, since issue seems to come with the kind of format of the frame buffer with this library.
(iOS version 14.6)
Reproduceable Code
What happened instead?
Does not recognize text, returns empty.
Relevant log output
Device
iPhone11 (iOS 14.6)
VisionCamera Version
2.13.3
Additional information