Image::Ocrad - Call ocrad, the GNU Optical Character Recognition utility


Image-Ocrad documentation Contained in the Image-Ocrad distribution.

Index


Code Index:

NAME

Top

Image::Ocrad - Call ocrad, the GNU Optical Character Recognition utility

SYNOPSIS

Top

  use Image::Ocrad;
  @characters = ocrad('some.pbm');

ABSTRACT

Top

  Use GNU ocrad to extract text from a PBM image file.  This module invokes
  ocrad with default options.

DESCRIPTION

Top

What it does

  Call's ocrad with the path to a PBM file supplied by the caller, and returns
  a list of characters extracted from the file.

Functionality not supported

  * inversion of image colors prior to processing
  * image transformations (reflection, rotation, etc)
  * recognition of alternative character sets (default is ascii)
  * extraction of a subset of recognized text

These features are possible by calling ocrad with extra options. Perhaps I'll add these features later if they're requested or I need them.

EXPORT

This function accepts a path to a PBM file as input, returns a list of recognized ascii characters as output.

SEE ALSO

Top

http://www.gnu.org/software/ocrad/ocrad.html

TODO

Top

  * XS code to link to an ocrad shared object rather than calling a system binary.
  This requires modifcation of the ocrad build, as it doesn't provide a shared
  object option in the configure/make process
  * Allow the ocrad binary to be installed in other than /usr/bin
  * Better exceptions.  Check that files exist or throw error, etc.

AUTHOR

Top

Allen Day, <allenday@ucla.edu>

COPYRIGHT AND LICENSE

Top


Image-Ocrad documentation Contained in the Image-Ocrad distribution.

package Image::Ocrad;
use strict;

require Exporter;

our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(ocrad);
our $VERSION = '0.01';

sub ocrad {
  my $pbm = shift;
  open(O, "/usr/bin/ocrad $pbm |");
 
  my $line = <O>; 
  chomp $line;
  close(O);

  my @result = split '', $line;
  return @result;
}

1;
__END__
# Below is stub documentation for your module. You'd better edit it!