Barcode-ZBar

 view release on metacpan or  search on metacpan

ZBar.pm  view on Meta::CPAN

scan from video:

    $reader->set_visible();
    $reader->set_active();
    $reader->user_wait();

collect results:

    my @symbols = $image->get_symbols();
    foreach my $sym (@symbols) {
        print("decoded: " . $sym->get_type() . ":" . $sym->get_data());
    }


=head1 DESCRIPTION

The ZBar Bar Code Reader is a library for scanning and decoding bar
codes from various sources such as video streams, image files or raw
intensity sensors.  It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128,
Code 93, Code 39, Codabar, Interleaved 2 of 5 and QR Code.

ZBar/ImageScanner.pod  view on Meta::CPAN


Enable the inter-image result consistency cache.

=item parse_config(I<configstr>)

Apply a decoder configuration setting.  See the documentation for
C<zbarcam>/C<zbarimg> for available configuration options.

=item recycle_image([I<image>])

Remove previously decoded results from a Barcode::ZBar::Image and
recycle the associated memory.

=back

=head1 SEE ALSO

Barcode::ZBar, Barcode::ZBar::Image, zbarimg(1), zbarcam(1)

http://zbar.sf.net

ZBar/Symbol.pod  view on Meta::CPAN

=pod

=head1 NAME

Barcode::ZBar::Symbol - bar code scan result object

=head1 SYNOPSIS

    my @symbols = $image->get_symbols();
    foreach my $sym (@symbols) {
        print("decoded: " . $sym->get_type() .
              ":" . $sym->get_data().
              "(" . $sym->get_count() . ")");
    }

=head1 DESCRIPTION

Barcode::ZBar::Symbol objects are constant results returned for each
bar code scanned from images or video.  This object wraps the raw
symbol data with additional information about the decode (symbology,
confidence, location, etc)

=head1 REFERENCE

=head2 Methods

=over 4

=item get_type()

The type of bar code "symbology" from which the data was decoded.

=item get_data()

The decoded data string.  Note that some symbologies can encode binary
data.

=item get_quality()

Confidence metric.  An unscaled integer value that indicates something
(intentionally unspecified) about the reliability of this result
relative to another.  Larger values are better than smaller values,
where "large" and "small" are application dependent.  Expect this
definition to become more specific as the metric is enhanced.

=item get_count()

Current cache count of the symbol.  This integer value provides
inter-scan reliability and redundancy information if enabled at the
Barcode::ZBar::ImageScanner.

=item get_orientation()

General orientation of decoded symbol.  This returns one of the
Barcode::ZBar::Orient constants, which provide a coarse, axis-aligned
indication of symbol orientation.

=item get_components()

Components of a composite result.  This yields an array of physical
component symbols that were combined to form a composite result.

=over 2

examples/processor.pl  view on Meta::CPAN

# initialize the Processor
$proc->init($ARGV[0] || '/dev/video0');

# setup a callback
sub my_handler {
    my ($proc, $image, $closure) = @_;

    # extract results
    foreach my $symbol ($proc->get_results()) {
        # do something useful with results
        print('decoded ' . $symbol->get_type() .
              ' symbol "' . $symbol->get_data() . "\"\n");
    }
}
$proc->set_data_handler(\&my_handler);

# enable the preview window
$proc->set_visible();

# initiate scanning
$proc->set_active();

examples/read_one.pl  view on Meta::CPAN


# read at least one barcode (or until window closed)
$proc->process_one();

# hide the preview window
$proc->set_visible(0);

# extract results
foreach my $symbol ($proc->get_results()) {
  # do something useful with results
  print('decoded ' . $symbol->get_type() .
        ' symbol "' . $symbol->get_data() . "\"\n");
}

examples/scan_image.pl  view on Meta::CPAN

$image->set_format('Y800');
$image->set_size($magick->Get(qw(columns rows)));
$image->set_data($raw);

# scan the image for barcodes
my $n = $scanner->scan_image($image);

# extract results
foreach my $symbol ($image->get_symbols()) {
    # do something useful with results
    print('decoded ' . $symbol->get_type() .
          ' symbol "' . $symbol->get_data() . "\"\n");
}

# clean up
undef($image);



( run in 0.481 second using v1.01-cache-2.11-cpan-26ccb49234f )