X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FImage%2FOpenALPR%2FPlateResult.pm;h=b24f899901da8da0e065fce32533fbc9cd61eba5;hb=4d4051da2ad5f86a0faad11d662e36882f7ed8be;hp=6cf165100ce2cfa0f582f2c7471123ee65d501b1;hpb=470f642024f42dc141fee27be6e46f7f0c620714;p=image-openalpr.git diff --git a/lib/Image/OpenALPR/PlateResult.pm b/lib/Image/OpenALPR/PlateResult.pm index 6cf1651..b24f899 100644 --- a/lib/Image/OpenALPR/PlateResult.pm +++ b/lib/Image/OpenALPR/PlateResult.pm @@ -4,9 +4,10 @@ use 5.014000; 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/); @@ -36,6 +37,7 @@ Image::OpenALPR::PlateResult - a license plate, as identified by OpenALPR =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] @@ -45,31 +47,45 @@ Image::OpenALPR::PlateResult - a license plate, as identified by OpenALPR =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 +=item $plate->B -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 +=item $plate->B The confidence value of the plate number returned by B. -=item B +=item $plate->B -True if the plate matches the plate pattern chosen via the B in L, false otherwise (or if no region was chosen). -=item B +True if the plate matches the plate pattern chosen via the +B in L, 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 -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 +=item $plate->B -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 and B methods. Each element is a partial Image::OpenALPR::PlateResult object -- only the B, B and B 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 and B +methods. Each element is a partial Image::OpenALPR::PlateResult object +-- only the B, B and B methods +will return a meaningful value. =back