yasirmturk / openalpr-swift

iOS Framework for the openalpr library ready to use in Swift and Objective-C.
GNU General Public License v3.0
38 stars 24 forks source link

Does not detect anything #11

Closed peterdk closed 5 years ago

peterdk commented 5 years ago

I am testing this library on a iPhone 7 with iOS 12. Unfortunately the detection always returns an empty array. I use the camera feed to test (with .480p resolution) but also providing a sample image does not yield any results. When using OpenALPR in Python on OSX, the same image succeeds.

Am I missing something?

alprScanner = OAScanner(country:"eu")
[..]

alprScanner!.scanImage(image, onSuccess: { (plates) in
                print(plates)
                if let plates = plates, let first = plates.first{
                    DispatchQueue.main.sync {
                        self.carPlateNumber.text = first.number
                    }
                }
                else{
                    DispatchQueue.main.sync {
                        self.carPlateNumber.text = "?"
                    }
                }
            }, onFailure: { (error) in
                DispatchQueue.main.sync {
                    self.carPlateNumber.text = "Error"
                }
            })
peterdk commented 5 years ago

It turns out the issue was that the image returned from the AVCaptureOutput was not pixelwise rotated. Only using UIImage(rotation:90) was not enough. The pixel data needed to rotate as well. Now it works ok.

yasirmturk commented 5 years ago

Good to hear that, usually there is a preprocessing required after capturing the raw camera images