RE: [PHP] simple OCR in php
| From: | Richard Lynch | Date: | Tue, 03 Jul 2007 05:51:19 +0000 |
| Subject: | RE: [PHP] simple OCR in php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258076@lists.php.net to get a copy of this message | ||
On Fri, June 29, 2007 11:32 am, Jay Blanchard wrote:
> [snip]
> I am looking for a way to incorporate some simple OCR into a php
> script.
> The
> user will bulk scan a pile of invoices. I want the php script to look
> at
> each
> invoice and read a number off the invoice. The image will then be
> renamed,
> and be organized into a directory and the file name will be added to a
> database. (all of these steps are straight forward once the number is
> read.)
> I have no problem with a system that requires a special OCR font
> and/or
> some
> sort of registration mark to help locate the Invoice number. Can
> anybody
> tell
> me of any tools out there that can do this?
> [/snip]
>
> In short PHP cannot perform OCR functions. You could insert an OCR
> application into the process and have the OCR app pass PHP the
> information.
Really?
So that OCR routine I wrote to hack a CAPTCHA doesn't exist?
Weird.
:-)
If you really do want to write OCR in PHP, it's pretty trivial:
http://php.net/imagecolorat
You'll need to build up a "dictionary" of known characters and define
a "distance" function to decide when two characters "match" or not,
but it's not rocket science.
It doesn't even qualify as Artificial Intelligence anymore. :-)
But since you have standard un-obfuscated content, using exec() to run
a well-established OCR package might be easier.
Or not, as I could never get the dang things to work in the first
place, personally. :-v
YMMV
NAIAA
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?