Image::OpenALPR - Perl binding for Automatic License Plate Recognition library


  use Image::OpenALPR;
  my $alpr = Image::OpenALPR->new('eu');
  $alpr->get_version; # 2.2.4
  my (@plates) = $alpr->recognise('many_plates.jpg');
  say 'Plates found: ', join ' ', map { $_->plate } @plates;

  my $data = read_file 'one_plate.gif';
  my $a_plate  = $alpr->recognise(\$data);
  my @cnd = @{$a_plate->candidates};
  say $cnd[0]->plate, ' ', $cnd[0]->confidence;
  say $cnd[1]->plate, ' ', $cnd[1]->confidence;


OpenALPR is an automatic license plate recognition library that extracts license plate numbers from images.

The following methods are available:

Image::OpenALPR->new($country, $config, $runtime_data)

Takes one mandatory argument (the country rules to use, such as eu or us) and two optional arguments: a path to the configuration file, and a path to the runtime_data directory.

Returns a new Image::OpenALPR instance. If initialisation fails (for example, if the chosen country is not available) an exception is thrown.


Takes a path to an image file or a reference to the contents of an image file and tries to find license plates in the image. In list context, it returns a list of Image::OpenALPR::PlateResult objects, one for each plate found. In scalar context it returns only one such object (the first plate found), or undef if no plates were found.


Returns the version of the OpenALPR library.


Changes the country rules in use.


Sets the camera calibration values, as obtained from the openalpr-utils-calibrate utility. Can also be set in the configuration file.


Sets the expected region for pattern matching. This improves accuracy. The matches_template flag is set on plates that match this pattern.


Sets the maximum number of candidates to return for one plate. Default is 10.



Marius Gavrilescu, <>


Copyright (C) 2016 by Marius Gavrilescu

This file is part of Image-OpenALPR.

Image-OpenALPR is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Image-OpenALPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with Image-OpenALPR. If not, see <>