yasirmturk / openalpr-swift Goto Github PK
View Code? Open in Web Editor NEWiOS Framework for the openalpr library ready to use in Swift and Objective-C.
License: GNU General Public License v3.0
iOS Framework for the openalpr library ready to use in Swift and Objective-C.
License: GNU General Public License v3.0
One question for you. How do you compile openalpr into iOS library? Thanks.
Hi,
first of all I want to say that this class working well with static image, but i cannot used it with UIIMAGE.
Another thing that can be useful: plate position (x,y) is not returning in plate object, maybe will be implemented
Regards and congratulation
Rodolfo
here my code
// Convert cropped image ref to UIImage
let imageToSave = UIImage(cgImage: imageRef, scale: 1.0, orientation: .right)
print("image: \(String(describing: imageToSave.size))") // Your Image
self.captureImageView.image = imageToSave
self.captureImageView.isHidden = false
if let data = UIImageJPEGRepresentation(imageToSave, 1) {
let filename = getDocumentsDirectory().appendingPathComponent("targa.jpg")
try? data.write(to: filename)
let imagePath = filename.path
// let imagePath = Bundle.main.path(forResource: "targadk", ofType: "jpg")
let alprScanner = OAScanner(country: "eu", patternRegion: "dk")
//alprScanner?.scanImage(imageToSave, onSuccess: {
alprScanner?.scanImage(atPath: imagePath , onSuccess: {
// alprScanner?.scanImage(newPhoto , onSuccess: {
(plates) in
plates?.forEach({ (plate) in
print("result: \(plate.number)")
print(plate)
})
}, onFailure: { (error) in
print("error: \(String(describing: error?.localizedDescription))")
})
}
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() {
// scanning the image
if let licenseText = scanLicensePlate(forImage: capturedImage!) {
print(licenseText)
licensePlateLabel.text = licenseText
}
// add the licenseInformationView as a subview to the main view
self.view.addSubview(licenseInformationView)
// configuring the licenseInformationView
licenseInformationView.layer.cornerRadius = 10 // slightly rounding the corners of the liceseInformationView
let height = self.view.frame.height * 0.8 // height of the license info
let width = self.view.frame.width * 0.9 // width of the license info
let posX = self.view.center.x - width / 2 // license info's x-position
let posY = self.view.safeAreaInsets.top + 3 // license info's y-position
licenseInformationView.frame = CGRect(x: posX, y: posY, width: width, height: height) // setting up the licenseInformationView with size and positions
licenseInformationView.transform = CGAffineTransform.init(scaleX: 0.7, y: 0.7) // scale it down to get a popUp-effect when appearing
licenseInformationView.alpha = 0 // making it invisible
// animate the window's popUp
UIView.animate(withDuration: 0.2) {
self.blurEffectView.effect = self.blurEffect // adding the blur-effect
self.licenseInformationView.alpha = 1 // making the licenseInformationView visible
self.licenseInformationView.transform = CGAffineTransform.identity // resizing the licenseInformationView to its original size
}
}`
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 😂
Is there a way to update the openalpr.conf file without having to create a version of the pod?
Hi there,
After doing a pod install, I tried to run the test, and I get a compile error on the import of the framework:
The line
@testable import openalpr_swift
gives an error:
Could not build Objective-C module 'openalpr_swift'
Got the following error message:
[!] The 'Pods-OCRTest' target has transitive dependencies that include static binaries: (/Users/a635219/Projects/test/OCRTest/Pods/OpenCV/opencv2.framework)
Hello,
This class is also working well on a video stream (with CoreVideo.framework) but the plates are not localized and read when they are slightly rotated (> 15 ° / 20 °) - I know it's not a bug but a feature ... but is it possible to make a change allowing the location of the plates whatever their angle of rotation ? Thanks in advance for your help and reply.
OldNick
Is possible to have an integration with Swift Package Manager?
After installing pod, I am trying to run the code and build is successful but unable to open the app in simulator.
dyld: lazy symbol binding failed: can't resolve symbol ___cxa_guard_acquire in /Users/52127608/Library/Developer/CoreSimulator/Devices/FC163F57-3BF9-4CDA-9E24-DAA7C8EADBC1/data/Containers/Bundle/Application/A97B39AF-FC7A-4AC0-9503-C36DF7265780/NJEZPass.app/NJEZPass because dependent dylib #1 could not be loaded
dyld: can't resolve symbol ___cxa_guard_acquire in /Users/52127608/Library/Developer/CoreSimulator/Devices/FC163F57-3BF9-4CDA-9E24-DAA7C8EADBC1/data/Containers/Bundle/Application/A97B39AF-FC7A-4AC0-9503-C36DF7265780/NJEZPass.app/NJEZPass because dependent dylib #1 could not be loaded
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"
}
})
Some times loss letter.
Some times rec I,O,Z to 1,0,2.
Hi there,
The code comes under GPL-3 and cannot be used in any iOS app according to AppStore licensing rules.
Hey, I followed your installation instructions and everything seems to be correct so far. But when I try to recognize a basic image (even the official example image http://plates.openalpr.com/h786poj.jpg) I get no results. I followed you example closely and have the following code:
let image = UIImage(named: "testImage")! let alprScanner = OAScanner(country: "eu", patternRegion: "de") print("ALPR version: \(alprScanner?.version())") alprScanner?.scanImage(image, onSuccess: { (plates) in print("found \(plates?.count) plate(s)") plates?.forEach({ (plate) in print("result: \(plate.number) : confidence: \(plate.confidence)") }) }, onFailure: { (error) in print("error: \(error)") })
All I'm getting is
ALPR version: 2.3.0 found Optional(0) plate(s)
Do you have any ideas what I might be doing wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.