PDA

View Full Version : [Under consideration] OCR and BCR for N900


mikevraziel
04-05-2008, 08:06 PM
Brainstorm http://maemo.org/community/brainstorm/view/ocr_for_n900/

Update 07-April-2008:
Attached the debian package below.

After installation run it through, MaemoPad in Extras menus
Changes made(compared to the binary)
Word wrap
Support for texts with more than 2K characters. Still limited , upto only 10K

Update 06-April-2008:
I have integrated the GNU OCR engine with maemopad. A menu item (to open PNM) and menu tab item (to do the same has been added). As you can see in the screen shots these open PNM(image) files. I am working on adding support to most image formats(jpeg,tiff, png, bmp etc etc) I have the Netpbm library compiled but somehow the other fileformat are not working. For now I can only provide the source code and binary. I will try to pack it into deb once I get sometime to figure it out. For now it seems to work fine. You can read upto 2048 characters. But this can be changed easily in the later releases.

Screenshots
Menu Option
http://aycu05.webshots.com/image/51724/2004426503416599584_fs.jpg

Source Image (Chapter 1, The Manifesto)
http://aycu18.webshots.com/image/50177/2004482105381181195_fs.jpg

OCR Result
http://aycu24.webshots.com/image/51023/2004486323818721198_fs.jpg

As you can see, more work to be done on work wrapping, aligning paragraphs, new line etc. Its about 3 times slower when compared to a Pentium 4 1.8GHz, 512MB , fedora 8 system. Just used the basic "time" command.

Package( binary, source, test images)
http://rapidshare.com/files/105337245/mocr.tar.gz.html

-----------------------------------------

Hi,
I have successfully ported GNU OCR
http://jocr.sourceforge.net/

Here are the source files
http://rapidshare.com/files/105190041/gocr_maemo.tar.gz.html

and a sample pnm to test it
http://rapidshare.com/files/105190569/ocr-b.pnm.html

and the binary for os2008 for n800,
http://rapidshare.com/files/105190878/gocr.html


And the results!

Test Image: ocr-b.pnm
http://aycu19.webshots.com/image/48938/2002120975078140694_fs.jpg


Nokia-N800-51-3:~# ./gocr ocr-b.pnm
nBcDEFGHIJKLmNoRsTuvwxyznöü
abcdefghijklmnopqrstuvwxyzäöüß
1234S6789O !''%&/()≡?\(}[I+*#'
<,;.:-

rbrewer123
04-06-2008, 01:11 AM
That's pretty cool... actually, I've been wondering if there is any barcode scanning software that could work from a photo taken by a NIT...

lardman
04-06-2008, 04:16 AM
That's pretty cool... actually, I've been wondering if there is any barcode scanning software that could work from a photo taken by a NIT...

I've written something in MATLAB (I want to be able to scan book barcodes and compare them to a database of my books) if you're interested. I'm planning on 'porting' it to Python, which shouldn't be too painful, I've just not got round to it yet.

Give me a shout if you'd like to see the MATLAB code and get it working on the device.

dan
04-06-2008, 04:36 AM
mikevraziel.

I used OCR on PC's but new to linux. Can you tell me what I need to do to get it loaded and running. Is there a .deb that you could provide. Any guidance, help would be greatly appreciated. Dan

mikevraziel
04-06-2008, 05:02 AM
I am looking into it too. At first attempt I would like to develope a mplayer-gui (wat ever the mplayer gui is called )
I am new to deb based systems. i use fedora and it would be really nice if someone can point me to where i can find information on making a deb package. sorry if this question has been answered before ! I really cant seem to find it. I did google for "maemo how to deb" or "maemo pack to deb".

rbrewer123
04-06-2008, 10:24 AM
lardman,

excellent, but I'm knee deep in getting the basics going on my NIT right now. Your ISBN application is great. Have you heard of Amazon's TextBuyIt service just announced? Eventually I'd also like to consider scanning UPC symbols. For now it's good to know this idea is in the oven.

rbrewer123
04-06-2008, 10:38 AM
mike,

Can't help much on packaging, though the bdist_debian section here links to some handy info on getting your own repo going. I think the packaging itself is specific to python sw.

http://home.cfl.rr.com/genecash/nokia/

mikevraziel
04-07-2008, 06:25 AM
lardman,
i think gnu ocr is capable of scanning barcodes. i will check that later today. ideally i would like to have an application like ABBY Finereader may be with some translation support.

I am going to Paris next month, hopefully i will be able to read my menu without my gf mocking me :P

Benson
04-07-2008, 10:59 AM
I've written something in MATLAB (I want to be able to scan book barcodes and compare them to a database of my books) if you're interested. I'm planning on 'porting' it to Python, which shouldn't be too painful, I've just not got round to it yet.

Give me a shout if you'd like to see the MATLAB code and get it working on the device.

GNU Octave (a MATLAB equivalent, with strong compatibility) has been available off and on for the ITs; it's probably slower than reimplementing, even in an interpreted language, but might be easier...
Anyway, any chance you could post it? or please PM me with it, if you're not interested in posting it publicly (for whatever reason)...

If it looks easy enough, I'll most likely re-implement it in C, and get a CLI/scriptable engine going, and let someone else make a python or C/GTK front-end.

Texrat
04-07-2008, 11:05 AM
THAT is freaking SWEET!

muki
04-07-2008, 11:20 AM
Re barcodes: this may interest someone: http://en.barcodepedia.com/

I just had a quick try but flash can't see the camera on my N810

Benson
04-07-2008, 11:41 AM
That's a well known limitation of Flash on the N8x0; this is the first time it's bothered me, though. Thanks for pointing out a flash webcam app I care about!

cashless
04-07-2008, 12:00 PM
Wow!!!! This is HUGE for me. Time to start converting all the shoddily scanned e-books that i have.

mikevraziel
04-07-2008, 03:49 PM
i am trying to add support for jpeg files. has anyone built djpeg tools ?

Bundyo
04-07-2008, 04:13 PM
Say, can't we use the crap camera with this library to get some nifty bacode reader?

http://www.libdmtx.org/

Benson
04-07-2008, 04:49 PM
I have tried netpbm from Debian lenny; seems to work (although it has libc version incompatibility).

lardman
04-07-2008, 06:10 PM
The .m code is here: http://people.bath.ac.uk/enpsgp/bar_code_reader2.m

It's pretty rough and ready (read development code). It doesn't do any filtering, so the image needs to be pretty clean. Also note that the image should be reasonably upright (and has to be the right way up, otherwise the code will come out backward and it probably won't like it ;) )

It should be straight forward to turn into Python (which has the added advantage that the camera can be manipulated simply using it too), I've just been a bit busy lately. Do let me know how you get on.

Mike, I'll be interested to see what other options the OCR reader has to offer too when I have a bit of time.

Cheers,


Simon

Benson
04-07-2008, 07:10 PM
The .m code is here: http://people.bath.ac.uk/enpsgp/bar_code_reader2.m

It's pretty rough and ready (read development code). It doesn't do any filtering, so the image needs to be pretty clean. Also note that the image should be reasonably upright (and has to be the right way up, otherwise the code will come out backward and it probably won't like it ;) )

It should be straight forward to turn into Python (which has the added advantage that the camera can be manipulated simply using it too), I've just been a bit busy lately. Do let me know how you get on.

Mike, I'll be interested to see what other options the OCR reader has to offer too when I have a bit of time.

Cheers,


Simon

Well, cleaning up the image doesn't really belong in the bar-code scanning program, anyway (IMHO). We can use netpbm; something like what we want may be gotten with pamtilt & pnmrotate (to auto-straighten), maybe pnmnlfilt (to clean up noise), and pnmnorm & pamdepth (crank up the contrast and squash to one bpp).

Then you've got a pretty good image, but maybe you still don't trust just one row out of the middle, but would rather an average? OK, pamcut out an arbitrary chunk, say the center 1/2 vertically, or maybe try to guess heuristically. Then pamscale -nomix can be used to squash it down to a single row; it'll take the more common color for each column.

Now you've got a single row of pixels, ready to apply that algorithm as it stands. That's what I'm thinking, anyway; if that's too slow, then the slow parts of the image processing can be converted to dedicated C code.

But I think scripting it together should give decent performance. I'll play around with it some; it'll probably be a couple weeks before I can look into porting it, but I'll play with the pbm pipeline, and with your code in Octave.

Starcruiser1229
04-07-2008, 11:26 PM
Another Avenue - ZXing Online Decoder - IF you have a good net connection, you can use zxing.org/w/decode.jspx and upload an image you snapped with the camera - it does not seem reliable, however, and I don't think it will be with the camera quality. The source code for this is available, however (I believe it is Java) on their website if you want to have a look.

I am not affiliated with this in any way - just found it while googling for barcode software.

For me, barcode software is cool but not really useful, but I will play with whatever you all come up with!

Patrick

geneven
04-08-2008, 02:31 AM
Did you ever notice that the Gutenberg Project does NOT have a copy of Das Kapital?? Amazing but true, last I checked.

mikevraziel
04-08-2008, 03:52 AM
Bloody capitalists !!!

jorjino
01-12-2010, 12:30 AM
Hello guys!

Does anyone knows is there a application with which we can scan business cards and make automatically contact in Contacts menu?

I used to use Abbyy BusinessCard Reader with my E90 and it works like a charm. Also in SonyEricsson P990 it was preinstalled very nice scanner for same application.

So, is there such application for Maemo 5 /N900?

Regards.

KHD
01-12-2010, 02:00 AM
Hello guys!

Does anyone knows is there a application with which we can scan business cards and make automatically contact in Contacts menu?

I used to use Abbyy BusinessCard Reader with my E90 and it works like a charm. Also in SonyEricsson P990 it was preinstalled very nice scanner for same application.

So, is there such application for Maemo 5 /N900?

Regards.

Looking for the same thing!

slender
01-12-2010, 03:19 AM
Have you guys already written to abby for request? Might take awhile but maybe worth of trying.

Bec
01-13-2010, 04:54 PM
As simple as it sounds!

Optical character recognition and business card reader for N900;
Why wait until you get home to digitize your documents when you can do it on the go?
Why bother typing the names and details of your associates when a simple photo can do all the work?

Brainstorm link: http://maemo.org/community/brainstorm/view/ocr_for_n900/

Please read this thread from the beginning as it contains the coding and the most relevant parts of the project. (http://talk.maemo.org/showthread.php?t=40377)

Thanks:)

sjgadsby
01-13-2010, 04:58 PM
I'd really appreciate if the mods will consider moving and merging the following threads
BCR: http://talk.maemo.org/showthread.php?t=40156
OCR: http://talk.maemo.org/showthread.php?t=18753
into this one.

Threads merged as requested.

Flandry
01-13-2010, 10:36 PM
LOL i was looking for the other business card scanner request thread to merge the second. Now i know where it went.

On device OCR has some really cool potential extensions. Someday...

mikhmv
01-15-2010, 04:50 PM
I would like to have OCR solution for business cards.
Brainstorm for this: http://maemo.org/community/brainstorm/view/busnes_card_recognizer/

Bec
01-15-2010, 05:18 PM
I would like to have OCR solution for business cards.
Brainstorm for this: http://maemo.org/community/brainstorm/view/busnes_card_recognizer/

There already is a brainstorm for that and it's already under consideration:
http://maemo.org/community/brainstorm/view/ocr_for_n900

Please remove your brainstorm and cast your vote there.

Thanks

qgil
01-17-2010, 10:05 AM
http://maemo.org/community/brainstorm/view/busnes_card_recognizer/ resolved as duplicate, thanks!

About Solution #1: Cuneiform or Tesseract? - can you please file 2 separate solutions, one for each port? Links to the original projects would be useful. Also helpful if you could explain in which toolkits are they based to see how feasible the porting would be.

Sorry, I haven't gone through the whole thread but I want to make sure you are aware of OCRFeeder running in Fremantle (http://www.joaquimrocha.com/2009/08/21/ocrfeeder-running-in-fremantle/)

Bec
01-29-2010, 04:53 PM
Please choose the second solution: http://maemo.org/community/brainstorm/view/ocr_for_n900/

News on OCRFeeder: http://www.joaquimrocha.com/2010/01/23/ocrfeeder-0-6-released-and-the-move-to-gnome/

magro
04-10-2010, 06:38 PM
I'm a C programmer, and I was thinking I could use tesseract engine to create an OBR app for N900. Any one else up to it? I think it would be fast, I just need to design a simple app using gtk that would display textboxes with tesseract's output so that the user could add the fields directly to some contact...

Bec
04-10-2010, 06:48 PM
Haven't seen anyone else on tesseract yet.
Any development is much appreciated though:D

lcuk
10-16-2010, 08:39 PM
I've written something in MATLAB (I want to be able to scan book barcodes and compare them to a database of my books) if you're interested. I'm planning on 'porting' it to Python, which shouldn't be too painful, I've just not got round to it yet.

Give me a shout if you'd like to see the MATLAB code and get it working on the device.

consider this a shout ;)