Re: [PHP] simple OCR in php

2007-07-04 Thread Ray
On Tuesday 03 July 2007 12:03 am, Richard Lynch wrote:
 On Sat, June 30, 2007 12:12 pm, Jay Blanchard wrote:
  [snip]
 
  In short PHP cannot perform OCR functions.
 
  Why? PHP provides all requisite functions/features so if someone was
  sadistic enough and talented enough there's nothing to stop them
  writing
 
  an OCR app using it.
  [/snip]
 
  Sure, but then the scanning device would have to be connected to the
  server. I suppose you could open a socket and stream the information
  to
  the server and then have PHP read and interpret the stream as it
  arrives. See how complex this is becoming?

 No, the scanning device could be on a desktop that builds a folder of
 files with names that can be tied back to the documents somehow.

 Or, for what the OP asked for, the whole thing could be on a server
 which is really a desktop where having the scanner connected would
 be pretty normal.

actually, the scanner is on a desktop, and  (to make a long story short) the 
server has part of the desktop hard-drive mounted as a network drive. Cron 
job tells php script to go look in a given folder on the desktop, process all 
files, and clean up after itself, all at 3 or 4 am.


 --
 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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-07-03 Thread Richard Lynch
On Sat, June 30, 2007 12:12 pm, Jay Blanchard wrote:
 [snip]
 In short PHP cannot perform OCR functions.

 Why? PHP provides all requisite functions/features so if someone was
 sadistic enough and talented enough there's nothing to stop them
 writing

 an OCR app using it.
 [/snip]

 Sure, but then the scanning device would have to be connected to the
 server. I suppose you could open a socket and stream the information
 to
 the server and then have PHP read and interpret the stream as it
 arrives. See how complex this is becoming?

No, the scanning device could be on a desktop that builds a folder of
files with names that can be tied back to the documents somehow.

Or, for what the OP asked for, the whole thing could be on a server
which is really a desktop where having the scanner connected would
be pretty normal.

-- 
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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-07-03 Thread Richard Lynch
On Sat, June 30, 2007 12:36 pm, Robert Cummings wrote:
 It was JUST as complex the first time someone did it in C, or Java, or
 what have your for a chosen language.

No, it was more complex, because it wasn't PHP.
:-)

-- 
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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 01:03 -0500, Richard Lynch wrote:
 On Sat, June 30, 2007 12:36 pm, Robert Cummings wrote:
  It was JUST as complex the first time someone did it in C, or Java, or
  what have your for a chosen language.
 
 No, it was more complex, because it wasn't PHP.
 :-)

Good point :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-07-03 Thread Andrei
Richard Lynch wrote:
 On Sat, June 30, 2007 12:12 pm, Jay Blanchard wrote:
   
 [snip]
 
 In short PHP cannot perform OCR functions.
   
 Why? PHP provides all requisite functions/features so if someone was
 sadistic enough and talented enough there's nothing to stop them
 writing

 an OCR app using it.
 [/snip]

 Sure, but then the scanning device would have to be connected to the
 server. I suppose you could open a socket and stream the information
 to
 the server and then have PHP read and interpret the stream as it
 arrives. See how complex this is becoming?
 

 No, the scanning device could be on a desktop that builds a folder of
 files with names that can be tied back to the documents somehow.

 Or, for what the OP asked for, the whole thing could be on a server
 which is really a desktop where having the scanner connected would
 be pretty normal.
   
It's better to focus on OCR code which reads and parses an image
file (usually tiff file). Obtaining the image is not that hard (at least
on linux).

   Andy


RE: [PHP] simple OCR in php

2007-07-02 Thread Richard Lynch
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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-06-30 Thread Jay Blanchard
[snip]
 In short PHP cannot perform OCR functions. 

Why? PHP provides all requisite functions/features so if someone was 
sadistic enough and talented enough there's nothing to stop them writing

an OCR app using it.
[/snip]

Sure, but then the scanning device would have to be connected to the
server. I suppose you could open a socket and stream the information to
the server and then have PHP read and interpret the stream as it
arrives. See how complex this is becoming? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-06-30 Thread Robert Cummings
On Sat, 2007-06-30 at 12:12 -0500, Jay Blanchard wrote:
 [snip]
  In short PHP cannot perform OCR functions. 
 
 Why? PHP provides all requisite functions/features so if someone was 
 sadistic enough and talented enough there's nothing to stop them writing
 
 an OCR app using it.
 [/snip]
 
 Sure, but then the scanning device would have to be connected to the
 server. I suppose you could open a socket and stream the information to
 the server and then have PHP read and interpret the stream as it
 arrives. See how complex this is becoming? 

It was JUST as complex the first time someone did it in C, or Java, or
what have your for a chosen language.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-06-30 Thread Stut

Jay Blanchard wrote:

[snip]
In short PHP cannot perform OCR functions. 


Why? PHP provides all requisite functions/features so if someone was 
sadistic enough and talented enough there's nothing to stop them writing


an OCR app using it.
[/snip]

Sure, but then the scanning device would have to be connected to the
server. I suppose you could open a socket and stream the information to
the server and then have PHP read and interpret the stream as it
arrives. See how complex this is becoming? 


Maybe it's just me, but OCR and scanning are certainly related but are 
by no means dependant on each other. Is it becoming complex or are you 
over-complicating it?


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-06-29 Thread Jay Blanchard
[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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-06-29 Thread Ray
On Friday 29 June 2007 10:32 am, you 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.

Exactly. 
Are there any third party tools or OCR applications that anybody can 
recommend? (I suppose you could write an OCR application in PHP, but that 
sounds like an awful lot of work.)
Thanks 
Ray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] simple OCR in php

2007-06-29 Thread Robert Cummings
On Fri, 2007-06-29 at 11:32 -0500, 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.

Why can PHP not perform OCR functions?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-06-29 Thread Crayon Shin Chan
On Saturday 30 June 2007 00:32, Jay Blanchard wrote:

 In short PHP cannot perform OCR functions. 

Why? PHP provides all requisite functions/features so if someone was 
sadistic enough and talented enough there's nothing to stop them writing 
an OCR app using it.

 You could insert an OCR 
 application into the process and have the OCR app pass PHP the
 information.

That would be the smart choice though.

-- 
Crayon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-06-29 Thread M. Sokolewicz

Robert Cummings wrote:

On Fri, 2007-06-29 at 11:32 -0500, 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.


Why can PHP not perform OCR functions?

Cheers,
Rob.


It's not so much impossible to perform OCR as it is unrealistic to do 
so. PHP contains only the very most basic support for such things, not 
to mention there are barely any (OS) libraries for PHP to do this, it's 
simply not realistic to try and make one if you're on your own. Other 
languages (ie. C) have libraries, written by people specifically for 
this purpose, so it seems clear to me: PHP is (currently) not the most 
realistic language to try and do OCR with, instead it'd be a lot easier 
(at this point) to borrow from another. Be this a low-level library in 
C, or a full-blown package, it doesn't matter.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-06-29 Thread Tijnema

On 6/29/07, M. Sokolewicz [EMAIL PROTECTED] wrote:

Robert Cummings wrote:
 On Fri, 2007-06-29 at 11:32 -0500, 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.

 Why can PHP not perform OCR functions?

 Cheers,
 Rob.

It's not so much impossible to perform OCR as it is unrealistic to do
so. PHP contains only the very most basic support for such things, not
to mention there are barely any (OS) libraries for PHP to do this, it's
simply not realistic to try and make one if you're on your own. Other
languages (ie. C) have libraries, written by people specifically for
this purpose, so it seems clear to me: PHP is (currently) not the most
realistic language to try and do OCR with, instead it'd be a lot easier
(at this point) to borrow from another. Be this a low-level library in
C, or a full-blown package, it doesn't matter.


Take the library of a C OCR program, write some PHP C code around it
and a new extension is born :)

Tijnema


--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple OCR in php

2007-06-29 Thread Robert Cummings
On Fri, 2007-06-29 at 22:57 +0200, M. Sokolewicz wrote:
 Robert Cummings wrote:
  On Fri, 2007-06-29 at 11:32 -0500, 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.
  
  Why can PHP not perform OCR functions?
  
  Cheers,
  Rob.
 
 It's not so much impossible to perform OCR as it is unrealistic to do 
 so. PHP contains only the very most basic support for such things, not 
 to mention there are barely any (OS) libraries for PHP to do this, it's 
 simply not realistic to try and make one if you're on your own. Other 
 languages (ie. C) have libraries, written by people specifically for 
 this purpose, so it seems clear to me: PHP is (currently) not the most 
 realistic language to try and do OCR with, instead it'd be a lot easier 
 (at this point) to borrow from another. Be this a low-level library in 
 C, or a full-blown package, it doesn't matter.

Well I agree with that, but as you indicate, it is possible to do it in
PHP, just not particularly practical :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php