use strict;
use warnings;
+use overload '""' => sub { shift->plate }, fallback => 1;
use parent qw/Class::Accessor::Fast/;
-our $VERSION = '0.001';
+our $VERSION = '0.001001';
__PACKAGE__->mk_ro_accessors(qw/plate confidence matches_template/);
=head1 SYNOPSIS
my $plate = $alpr->recognise('t/example.jpg');
+ say $plate; # ZP36709
say $plate->plate; # ZP36709
say $plate->confidence; # 92.373634
my @coords = $plate->coordinates; # [306, 351], [476, 351], [476, 384], [306, 384]
=head1 DESCRIPTION
-Image::OpenALPR::PlateResult is a class representing a plate identified by OpenALPR. It offers the following methods:
+Image::OpenALPR::PlateResult is a class representing a plate
+identified by OpenALPR. It offers the following methods:
=over
-=item B<plate>
+=item $plate->B<plate>
-The plate number that has the highest confidence value (likelihood of being correct).
+The plate number that has the highest confidence value (likelihood of
+being correct). An object of this class will stringify to the return
+value of this method.
-=item B<confidence>
+=item $plate->B<confidence>
The confidence value of the plate number returned by B<plate>.
-=item B<matches_template>
+=item $plate->B<matches_template>
-True if the plate matches the plate pattern chosen via the B<set_default_region> in L<Image::OpenALPR>, false otherwise (or if no region was chosen).
-=item B<coordinates>
+True if the plate matches the plate pattern chosen via the
+B<set_default_region> in L<Image::OpenALPR>, false otherwise (or if no
+region was chosen).
-In list context, returns a four element list representing the vertices of the license plate, numbered clock-wise from top-left. Each element is an arrayref with two elements: the X coordinate followed by the Y coordinate.
+=item $plate->B<coordinates>
-In scalar context, returns an arrayref to an array containing the list described above.
+In list context, returns a four element list representing the vertices
+of the license plate, numbered clock-wise from top-left. Each element
+is an arrayref with two elements: the X coordinate followed by the Y
+coordinate.
+In scalar context, returns an arrayref to an array containing the list
+described above.
-=item B<candidates>
+=item $plate->B<candidates>
-In list context, returns a list of candidate license numbers, in decreasing order of confidence. The first element coincides with the plate/confidence pair returned by the B<plate> and B<confidence> methods. Each element is a partial Image::OpenALPR::PlateResult object -- only the B<plate>, B<confidence> and B<matches_template> methods will return a meaningful value.
+In list context, returns a list of candidate license numbers, in
+decreasing order of confidence. The first element coincides with the
+plate/confidence pair returned by the B<plate> and B<confidence>
+methods. Each element is a partial Image::OpenALPR::PlateResult object
+-- only the B<plate>, B<confidence> and B<matches_template> methods
+will return a meaningful value.
=back