Unmaintained. Read the plate with a small vision model.
I used to maintain this gem. It wraps OpenALPR: a native install, a country runtime, and a state pattern. A small model that can see the photo returns the plate number from the image. Run it locally so the plate stays on your machine.
Gemma 4 E4B is the size to start with. With Ollama:
ollama run gemma4:e4b ./lc.jpg Read the license plate. Reply with the plate number only.
Put the image path before the prompt. Try it on a few of your own photos before you trust the string.
Legacy: OpenALPR wrapper
You'll need to install openALPR. I used brew update && brew install openalpr, on macOS.
For Linux see the official wiki
Installation
Requires Ruby version 2.3 or higher
Add this line to your application's Gemfile:
gem 'alpr'And then execute:
$ bundle
Or install it yourself as:
$ gem install alpr
Usage
search = Alpr.new("lc.jpg")
puts search.outputFor USA license plates specify an optional state pattern (eg. Ohio = "oh" )
search = Alpr.new("lc.jpg", :us, "oh")
puts search.outputContributing
- Fork it ( https://github.com/zjwhitehead/alpr/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request