Archive for the ‘odf’ Category

OCRFeeder Repository Relocation and Maemo Preview

Wednesday, October 7th, 2009

It’s been a while since I wrote my last post but I guess this one will compensate.

When I posted about how I made OCRFeeder run in Fremantle I said I wasn’t thinking of porting the application but in later talks with some people, it was clear that OCRFeeder might come in handy for some people.
One of the use cases that we have talked about was to be able to create a contact in the address book by recognizing the contact fields from a business card.

So, for some days in these last weeks, I’ve been porting OCRFeeder to Fremantle!
(The card-to-contact feature is still to come as I wanted to have OCRFeeder “fremantelized” before)

New Respository

I had been using git-svn to develop OCRFeeder and while this was okay when there was just a branch (trunk), with the Maemo version it was clear that Google Code’s SVN repository wasn’t enough. (Yes, I know they have mercurial but I’m git user)
So, yesterday I relocated OCRFeeder’s development to Gitorious where you’ll find the branch “maemo” besides the “master” one: http://gitorious.org/ocrfeeder

Development Notes

I must say that although I had for a long time used PyGTK for my UI code, on Hildon, I am more experienced in using C. While from the theory part this is the same, on the practical side, the PyMaemo bindings had some issues that delayed the development a bit (mainly undocumented functions that differ from the direct and expected usage, as well as some bugs I found).
I must thank Lizardo and other PyMaemo folks who were kind enough to help me every time I bugged them with questions and suggestions.

I think OCRFeeder for Maemo represents another example of how a desktop targetted application can be ported to Fremantle, specially from the design point of view. The chats I had with my friend and colleague Felipe (who, by the way, has just become a Master degree student in a in User-Centered Interactive Technologies) surelly helped in this matter.

Trying OCRFeeder for Maemo

Now, you can try to use OCRFeeder but you’ll have to first compile and install pygoocanvas and Tesseract or another OCR engine like I wrote here. I hope I have time to create deb packages for both pygoocanvas and Tesseract as they’re also very useful apps to have.

As a final note, I must say that although everything was working fine on Maemo 5.0 SDK beta 2, today the final SDK was released and I tested OCRFeeder on it… and not everything works well as before. The problems are mainly related to GtkTreeViews (Hildon style) which, from the C side seem to be working okay, but from the PyMaemo side seems not to obey the selection mode I assign to it.

Some Eye Candy…

OCRFeeder for Maemo preview from Joaquim Rocha on Vimeo.

Preferences dialog

Preferences dialog

Recognized page

Recognized page

OCRFeeder running in Fremantle

Friday, August 21st, 2009

During my hackfest time in Igalia I thought it’d be interesting to see how much it’d take to make OCRFeeder run in Fremantle just like Stefan Kost did for Jokosher and Pitivi talked about during GCDS.

At the beginning, I thought it’d be a little difficult (I thought I’d need a lot of stuff)
So I installed libgoocanvas-dev, checked out pygoocanvas and compiled it (I also needed to manually copy the generated egg from Python 2.3’s site-packages to Python 2.5’s). After that, no OCR engines available so I installed OCRAD which was pretty easy. I also decided to give a shot at installing Tesseract which went wrong supposedly due to a broken make file or something but this week that problem was fixed and now Tesseract works like a charm!

I’m not thinking of porting OCRFeeder to Maemo (it is an office application that wouldn’t be very easy to use on a device nor it makes sense to want to do that kind of office task in a mobile device) but it was indeed nice to see how easy it is to make a GNOME application written in Python to work on it.

OCR can have many interesting applications in a mobile device and I got a few ideas stashed in a corner of my memory so, if the time allows, I’ll try to put some to practice in the future.

Here are some screenshots of OCRFeeder and the result ODT document (yes, the ODFPy modules worked fine as well):

OCRFeeder in Fremantle

Resulting ODT from OCRFeeder produced in Fremantle

OCRFeeder hacking, caring about Tesseract

Sunday, August 16th, 2009

Today I was hacking a bit on OCRFeeder.
Since I released it that I wanted to give better support for Tesseract since it’s one of the best Open Source OCR engines out there.
The problem was that the image clips that I simply converted to TIF wouldn’t work when trying to read them with the mentioned engine.
After a bit of investigation I found that I needed to first convert my Image object to grayscale before saving it to TIF… After doing this, Tesseract worked like a charm for me!

I also found a few bugs on the OCR Engines’ managing dialog and corrected them so you don’t have to kill yourself editing the engines’ XML files.

Note that unlike engines such as GOCR or OCRAD, Tesseract won’t print its results to stdout, instead it receives a file name as argument and produces a .txt file with the results.
This has a been supported in OCRFeeder since its first release so, you only have to use the $FILE special keyword when configuring the Tesseract engine and print the contents of that file to stdout using for example “cat”.
Here’s a screenshot of a correct Tesseract configuration:

Tesseract engine configuration on OCRFeeder

And the produced XML file:

<?xml version=”1.0″ encoding=”utf-8″?>
<engine>
<name>Tesseract</name>
<image_format>TIF</image_format>
<engine_path>/usr/local/bin/tesseract</engine_path>
<arguments>$IMAGE $FILE; cat $FILE.txt</arguments>
</engine>

I’ll soon post here a list of ToDos that I want to have done soon. So far, the “better Tesseract support” and the “fit image size” ones are already implemented.

Enjoy!

Going to GUADEC

Thursday, July 2nd, 2009

I mean Gran Canaria Desktop Summit, an event joining GUADEC and aKademy!

Tomorrow I’ll fly to Gran Canaria to attend this great event and I got lots of good expectations since it’s gonna be my first GUADEC.
I hope to attend many conferences and hang out with fellow Igalians and friends.

A lot of important names in our world of Open Source and particularly, Open Desktop will be there so it can only be great!

I’ll give two talks in there. A lightning talk about my OCR project — OCRFeeder — and another one that gives a practical view on the new Hildon (or “The Fremantle Way”).
By the way, I used ReStructured Text to do my presentation (using the rst2odp script) and save time from using Open Office. You should try it too.

So, thanks to my dear girlfriend everything is packed already (I always think my socks time-traveled to Narnia), the camera battery is charged, presentations are finished and I’m ready to go — I don’t mention my laptop because we’re “symbiotically” connected and where I go “he” goes.

Hope to see you there!

Easily install OCRFeeder

Sunday, June 28th, 2009

I’ve just created and pushed a setup.py script to let you easily install OCRFeeder.

Setuptools are really a great tool and although it was the first time I used them, it was so straightforward!
Now, to install OCRFeeder all you have to do is to download it:

$ sudo python setup.py install

Awesome!

I’ll try to have it on PyPI soon as well so it gets even easier for everyone to use my OCR project.
Stay tuned!