NAME
Image::OpenALPR - Perl binding for Automatic License Plate Recognition library
SYNOPSIS
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
;
$alpr
->set_top_n(2);
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;
DESCRIPTION
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
orus
) 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.
- $alpr->recognise($file)
- $alpr->recognise(\$data)
-
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.
- $alpr->get_version
- $alpr->getVersion
-
Returns the version of the OpenALPR library.
- $alpr->set_country($country)
- $alpr->setCountry($country)
-
Changes the country rules in use.
- $alpr->set_prewarp($prewarp)
- $alpr->setPrewarp($prewarp)
-
Sets the camera calibration values, as obtained from the
openalpr-utils-calibrate
utility. Can also be set in the configuration file. - $alpr->set_default_region($region)
- $alpr->setDefaultRegion($region)
-
Sets the expected region for pattern matching. This improves accuracy. The matches_template flag is set on plates that match this pattern.
- $alpr->set_top_n($n)
- $alpr->setTopN($n)
-
Sets the maximum number of candidates to return for one plate. Default is 10.
SEE ALSO
http://www.openalpr.com, https://github.com/openalpr/openalpr
AUTHOR
Marius Gavrilescu, <marius@ieval.ro>
COPYRIGHT AND LICENSE
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 <http://www.gnu.org/licenses/>