Just poked around CPAN to find a module for a simple OCR (optical character recognition) task. I stumbled across OCR::PerfectCR, written by fellow perlmonk
theorbtwo.
I realized that this module would only solve easy tasks, so I gave it a simple image containing a single character.
The documentation is a bit sketchy (what's the format of a character map?), so I dumped out the result with Data::Dumper:
use OCR::PerfectCR;
use GD;
use Data::Dumper;
my($file) = @ARGV;
die "No file" unless defined $file;
my $recognizer = OCR::PerfectCR->new;
$recognizer->load_charmap_file("charmap");
my $image = GD::Image->new($file) or die;
my(@out) = $recognizer->recognize($image);
print Dumper(\@out);
which printed the following:
'width' => 18,
'str' => "\x{fffd}",
'endcol' => 18,
'startcol' => 0,
'color' => '163',
'bgrgb' => [
148,
202,
212
],
'chrwidth' => '18',
'md5' => '9454596172a32923111c25373a801472',
'prespace' => 0
Hmm. So where's the result? Is it really "\x{fffd}"?
Alternatively, can anyone recommend a solution that works?
As previously discussed, there's issues with getting proper OCR, but if you know of anything that actually works, please let me know.