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.


In reply to Does OCR::PerfectCR work at all? by saintmike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.