Skip to contentSkip to conversation

Convert PBM to ascii text??

DISCUSSION Hal MacArgle 3 participants 9 messages Mar 8, 2004 – Mar 11, 2004

lore
Share & tools
lore
#0 lore raw

Greetings: Been reading and viewing tons of stuff but can't seem to find if there's a "simple" solution I need..

Would like to scan a normal black on white typewritten page to a PBM file, "P4", then convert that to a standard text ascii file.. (My scanner is a HP ScanJet IIC, that defaults PBM)

My "pen friend" insists on sending me snail mail and letting me reply via eMail.. I would like to import part of his text into my document
- as is usually done..

Any suggestions as to an easy solution? Both the OCR programs and PBMPlus package are, seemingly, way too powerful for my simple requirement.. (Or are they?) <grin>

TIA and cheers,

Hal - in Terra Alta, WV - Slackware GNU/Linux 9.0 (2.4.20)
Utrum Per Hebdomadem Perveniam
.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 7 lines · Hal MacArgle

Greetings: Been reading and viewing tons of stuff but can't seem to find if there's a "simple" solution I need..

Would like to scan a normal black on white typewritten page to a PBM file, "P4", then convert that to a standard text ascii file.. (My scanner is a HP ScanJet IIC, that defaults PBM)

Quoted 7 lines

My "pen friend" insists on sending me snail mail and letting me reply via eMail.. I would like to import part of his text into my document
- as is usually done..

Any suggestions as to an easy solution? Both the OCR programs and PBMPlus package are, seemingly, way too powerful for my simple requirement.. (Or are they?) <grin>

Well ... if you want to convert the text in a graphic image .... whether it is on a page or in a file ... to ascii text, you need to do OCR. That's what "OCR" means, after all. I haven't done this on Linux myself, but my instinct would be to try gocr for it, especially since the package docs for it say it reads pbm files (among other types).

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#2 lore raw
Quoted 18 lines · Ray Olszewski
Quoted 7 lines · Hal MacArgle

Greetings: Been reading and viewing tons of stuff but can't seem to find if there's a "simple" solution I need..

Would like to scan a normal black on white typewritten page to a PBM file, "P4", then convert that to a standard text ascii file.. (My scanner is a HP ScanJet IIC, that defaults PBM)

Quoted 7 lines

My "pen friend" insists on sending me snail mail and letting me reply via eMail.. I would like to import part of his text into my document
- as is usually done..

Any suggestions as to an easy solution? Both the OCR programs and PBMPlus package are, seemingly, way too powerful for my simple requirement.. (Or are they?) <grin>

Quoted 5 lines

Well ... if you want to convert the text in a graphic image .... whether it is on a page or in a file ... to ascii text, you need to do OCR. That's what "OCR" means, after all. I haven't done this on Linux myself, but my instinct would be to try gocr for it, especially since the package docs for it say it reads pbm files (among other types).

Greetings Ray and thanks for the input.. I've fetched gocr
and noted the "text in graphic image" mentioned and should compile it to see if it'll work for me, but it needs some dependencies I don't have on this machine so thought I'd try the easy query way first.

I was, hoping, to find a program that will convert the scan
to plain ordinary character generated text, rather than bit mapped.. I'm hazy about what all this means plus my quest for simplicity is not the modern way to think.. I want to, merely, write the guy using all my brain power to compose/answer his letter - not spend all my time figuring out complicated manipulations for non significant stuff.. <g>

Appreciate!!

Hal - in Terra Alta, WV - Slackware GNU/Linux 9.0 (2.4.20)
Utrum Per Hebdomadem Perveniam
.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw
Quoted 7 lines · Hal MacArgle

[...]

Greetings Ray and thanks for the input.. I've fetched gocr
and noted the "text in graphic image" mentioned and should compile it to see if it'll work for me, but it needs some dependencies I don't have on this machine so thought I'd try the easy query way first.

Quoted 7 lines

I was, hoping, to find a program that will convert the scan
to plain ordinary character generated text, rather than bit mapped.. I'm hazy about what all this means plus my quest for simplicity is not the modern way to think.. I want to, merely, write the guy using all my brain power to compose/answer his letter - not spend all my time figuring out complicated manipulations for non significant stuff.. <g>

Yes, I got that from your earlier message. What confuses me is that you seem to think this process ... "convert the scan to plain ordinary character generated text, rather than bit mapped" involves something other than OCR software. The process you describe here *is* OCR (Optical Character Recognition), so looking for something other than OCR software to do it is an exercise in futility (or miscommunication).

You have two basic options:

1. Run a program that will scan to an image file, then a separate program that will do OCR on the scanned image.

2. Run a single program that will do both steps described in (1) ... probably saving the scan as a scratch file and deleting it after the OCR step.

In practice on Linux/Unix systems, any program of the second sort will probably be a wrapper for two separate apps that function as in (1) ... sort of the way "abcde" automates the process of CD ripping by serving as a frontend to about a half-dozen different applications.

The only OCR programs I can find in the Debian package database are gocr and clara. Several other scanner apps refer to OCR, but they all seem to call gocr in the background actually to do it. Rwally, gocr seems like the consensus solution for Linux users.

If neither gocr nor clara is suitable, your next option is to consider a commercial product. This article -- http://www.linuxworld.com/story/32641.htm -- describes one called "OCR Shop" ... but its pricing appears to be way too high to make sense for the simple need you have.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#4 lore raw
Quoted 16 lines · Ray Olszewski
Quoted 7 lines · Hal MacArgle

[...]

Greetings Ray and thanks for the input.. I've fetched gocr
and noted the "text in graphic image" mentioned and should compile it to see if it'll work for me, but it needs some dependencies I don't have on this machine so thought I'd try the easy query way first.

Quoted 7 lines

I was, hoping, to find a program that will convert the scan
to plain ordinary character generated text, rather than bit mapped.. I'm hazy about what all this means plus my quest for simplicity is not the modern way to think.. I want to, merely, write the guy using all my brain power to compose/answer his letter - not spend all my time figuring out complicated manipulations for non significant stuff.. <g>

Quoted 6 lines

Yes, I got that from your earlier message. What confuses me is that you seem to think this process ... "convert the scan to plain ordinary character generated text, rather than bit mapped" involves something other than OCR software. The process you describe here *is* OCR (Optical Character Recognition), so looking for something other than OCR software to do it is an exercise in futility (or miscommunication).

Greetings: Mis-communication is my middle name methinks..

Quoted 5 lines

You have two basic options:

1. Run a program that will scan to an image file, then a separate program that will do OCR on the scanned image.

Done - scan to PBM (P4) then run Gocr to get a bit mapped
file.. Trouble is; even using resolution 360, slow and a big PBM file, the final copy is about 90% accurate and the original format of the letter compromized losing paragraphs, offsets, indents, etc... Taking the time to do all this plus fix up the immediate above would take almost as long as manually re-typing the page..

I fetched Clara but could only find a .rpm file, no tarball
could for Slackware, etc.. Slack has a rpm program but the dependencies needed to extract looked like they were mostly Red Hat's filenames..

The PBM file was good - converting it to postscript and
printing on an ancient laser printer - the copy was very close to the original.. So the problem is in the recognition phase, admittedly a very tough nut according to the developers..

Very interesting though how it's done by "boxing" each
character, etc... I've learned a lot..

Quoted 4 lines

In practice on Linux/Unix systems, any program of the second sort will probably be a wrapper for two separate apps that function as in (1) ... sort of the way "abcde" automates the process of CD ripping by serving as a frontend to about a half-dozen different applications.

I'm a CLI person so no front ends involved here..

Quoted 10 lines

The only OCR programs I can find in the Debian package database are gocr and clara. Several other scanner apps refer to OCR, but they all seem to call gocr in the background actually to do it. Rwally, gocr seems like the consensus solution for Linux users.

If neither gocr nor clara is suitable, your next option is to consider a commercial product. This article --
http://www.linuxworld.com/story/32641.htm -- describes one called "OCR Shop" ... but its pricing appears to be way too high to make sense for the simple need you have.

Appreciate very much your comments and will look into non
open source but am not optimistic from what I've read and heard about OCR in any platform.. I've read too many disclaimers on software packages I guess. <grin>

Hal - in Terra Alta, WV - Slackware GNU/Linux 9.0 (2.4.20)
Utrum Per Hebdomadem Perveniam
.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#5 lore raw

Sounds like a good alternate solution for you, Hal - but one which is likely only available for proprietary operating systems produced by corporations bent on world market domination - would be speech recognition software. Read your friend's note into the computer, and have it produce typed and formatted text. I guess it'll be a few years before I can say:
"Hal, why don't you look into speech recognition software for Linux as a solution to this problem?" Meantime, we can at least dream about it and identify it as a need, can't we?

James

PS This presumes you've got audio-in working on your Linux box, which can be another challenge in itself.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#6 lore raw
Quoted 10 lines · James Miller

Sounds like a good alternate solution for you, Hal - but one which is likely only available for proprietary operating systems produced by corporations bent on world market domination - would be speech recognition software. Read your friend's note into the computer, and have it produce typed and formatted text. I guess it'll be a few years before I can say:
"Hal, why don't you look into speech recognition software for Linux as a solution to this problem?" Meantime, we can at least dream about it and identify it as a need, can't we?

James

Greetings: Good suggestion - never thought of that, but I've
found it easier to confront him with the query of why he insists on snail mail when he has all kinds of computer power, etc.. <grin>

Quoted 3 lines

PS This presumes you've got audio-in working on your Linux box, which can be another challenge in itself.

Simple audio for this kind of thing no real problem according
to my notes which I wont confirm.. And have to presume the levels are default OK and that the mic input isn't muted.. <g>

dd bs=8k count=(n in seconds) < /dev/audio > sample.voc #[record]

cat sample.voc > /dev/audio #[listen]

Oh but the file lengths. <grin> Thanks again.. (Don't know where I got the above but it did work when I tried using it for a singing "telegram." HI..

Hal - in Terra Alta, WV - Slackware GNU/Linux 9.0 (2.4.20)
Utrum Per Hebdomadem Perveniam
.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#7 lore raw
In reply to Hal MacArgle

At 08:59 AM 3/10/2004 -0500, Hal MacArgle wrote:
[...]

Quoted 9 lines
Quoted 2 lines

1. Run a program that will scan to an image file, then a separate program that will do OCR on the scanned image.

Done - scan to PBM (P4) then run Gocr to get a bit mapped
file.. Trouble is; even using resolution 360, slow and a big PBM file, the final copy is about 90% accurate and the original format of the letter compromized losing paragraphs, offsets, indents, etc... Taking the time to do all this plus fix up the immediate above would take almost as long as manually re-typing the page..

Yes, this is always the problem with OCR. Back when I did a lot of it (about 12-15 years ago, on a Macintosh), OCR packages included the "brag" that they were 99% accurate. I, like any serious user, had no trouble translating "99% accurate" to "an error every 3 lines of text" and was unimpressed. For everyday use, OCR needs about "four 9s" of accuracy, translating to one error every few pages of text.

If your 90% estimate is correct, it translates to (on average) several errors per line of text, making the process close to worthless for you.

Of course, any OCR package is better on some images than others. I don't know what your source pages look like. For example, serif fonts (e.g., Times Roman, Century Schoolbook, Palatino) are generally easier to OCR well than sanserif fonts (e.g., Ariel, anything with "sans" in the name). Fresh printouts are better then third-generation Xeroxes. And so on.

I expect that you are at the point where you need help from someone with real and current expertise in OCR work, preferably on Linux. That's not me, and from the surrounding silence, I suspect it is not to be found on this list.

Quoted 4 lines

I fetched Clara but could only find a .rpm file, no tarball
could for Slackware, etc.. Slack has a rpm program but the dependencies needed to extract looked like they were mostly Red Hat's filenames..

Well ... a source .tgz can be downloaded from a link on this page --
http://www.claraocr.org/

(Thank you, Google).

I can find prepackaged binaries only for SuSE and Debian, myself.

Quoted 7 lines
Quoted 3 lines

In practice on Linux/Unix systems, any program of the second sort will probably be a wrapper for two separate apps that function as in (1) ... sort of the way "abcde" automates the process of CD ripping by serving

as a

Quoted 1 line

frontend to about a half-dozen different applications.

I'm a CLI person so no front ends involved here..

Just a clarification ... not all front ends are graphical, X-based fronetnds. The example, I gave, abcde, is a CLI-based "wrapper" script, but it hands off actual processing to about a half dozen different applications that work behind the scenes.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#8 lore raw
Quoted 28 lines · Ray Olszewski

At 08:59 AM 3/10/2004 -0500, Hal MacArgle wrote:
[...]

Quoted 9 lines
Quoted 2 lines

1. Run a program that will scan to an image file, then a separate program that will do OCR on the scanned image.

Done - scan to PBM (P4) then run Gocr to get a bit mapped
file.. Trouble is; even using resolution 360, slow and a big PBM file, the final copy is about 90% accurate and the original format of the letter compromized losing paragraphs, offsets, indents, etc... Taking the time to do all this plus fix up the immediate above would take almost as long as manually re-typing the page..

Yes, this is always the problem with OCR. Back when I did a lot of it (about 12-15 years ago, on a Macintosh), OCR packages included the "brag" that they were 99% accurate. I, like any serious user, had no trouble translating "99% accurate" to "an error every 3 lines of text" and was unimpressed. For everyday use, OCR needs about "four 9s" of accuracy, translating to one error every few pages of text.

If your 90% estimate is correct, it translates to (on average) several errors per line of text, making the process close to worthless for you.

Of course, any OCR package is better on some images than others. I don't know what your source pages look like. For example, serif fonts (e.g., Times Roman, Century Schoolbook, Palatino) are generally easier to OCR well than sanserif fonts (e.g., Ariel, anything with "sans" in the name). Fresh printouts are better then third-generation Xeroxes. And so on.

Quoted 5 lines

I expect that you are at the point where you need help from someone with real and current expertise in OCR work, preferably on Linux. That's not me, and from the surrounding silence, I suspect it is not to be found on this list.

Greetings: And your detailled comments most valuable as
usual.. It stands to reason the fonts must "match" the design.. I just looked at my cheque book and the "crazy" numeral "style." I read further that OCR's, even the pricey ones, have a real problem when the text is in italics after a long run of "normal." The banking system had better "match" eh??

Quoted 10 lines
Quoted 4 lines

I fetched Clara but could only find a .rpm file, no tarball
could for Slackware, etc.. Slack has a rpm program but the dependencies needed to extract looked like they were mostly Red Hat's filenames..

Well ... a source .tgz can be downloaded from a link on this page --
http://www.claraocr.org/

(Thank you, Google).

I, of course, used google/linux but entered ocr and got the
"wrong" Clara site.. Thanks. I will try the tar ball but am pessimistic of course.. Methinks Patrick at Slackware doesn't include ocr in his packages for good reason...

Appreciate!!

Hal - in Terra Alta, WV - Slackware GNU/Linux 9.0 (2.4.20)
Utrum Per Hebdomadem Perveniam
.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs