Closed tuxedotu closed 6 years ago
how do u implement scanLicensePlate(forImage: capturedImage!)
??
That's the scanLicensePlate-function:
`func scanLicensePlate(forImage image: UIImage) -> String? { let scanner = OAScanner(country: "eu", patternRegion: "at") var licenseText :String?
scanner?.scanImage(image, onSuccess: { (plates) in plates?.forEach({ (plate) in licenseText = plate.number })
}, onFailure: { (error) in
print("error: \(String(describing: error?.localizedDescription))")
})
return licenseText
}`
Sry that was messed up. Here's the code again:
func scanLicensePlate(forImage image: UIImage) -> String? {
let scanner = OAScanner(country: "eu", patternRegion: "at")
var licenseText :String?
scanner?.scanImage(image, onSuccess: { (plates) in plates?.forEach({ (plate) in licenseText = plate.number })
}, onFailure: { (error) in
print("error: \(String(describing: error?.localizedDescription))")
})
return licenseText
}
The thing is, if i pass an image from my Assets-folder, it works but as soon as i pass the image which was currently taken (both are UIImages), it doesn't work at all
plz check the guide here: https://github.com/cardash/react-native-openalpr#capturequality you need to pre-process the taken image
I currently try to include the OpenALPR in a Project, where I can take pictures of a plate and the app should recognise the plate. However for some reason it does not work...
This is the capturePhoto-function:
It is the following command:
cameraOutput.capturePhoto(with: settings, delegate: self)
which calls the following function:
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) { if let photoData = photo.fileDataRepresentation() { capturedImage = UIImage(data: photoData) showLicenseInfoView() } }
And the showLicenseInfoView-function looks like this:
`func showLicenseInfoView() {
However the licenseText is still nil and the licensePlateLabel doesn't get assigned... I really need help cause I have no goddamn idea why it doesn't work 😂