Can't find what you need? Try here:
Loading

Saturday, April 11, 2009

I will describe here my short experience in trying to develop image processing applications using python.

I am developing on Ubuntu, which I highly recommend. For anyone familiar with Linux but is afraid of all the trouble in installing it, Ubuntu is an extremely user friendly environment with an almost Plug-and-Play installation process (you can download it here Ubuntu Download).
For developers linux/ubuntu offers many opensource tools which are easily accessible and ready to use.

The application I am working on involves crawling the web, searching for images, creating a DB of these images and then processing theses images in order to create a useful indexing (you might say it is sort of an image retrieval search engine). It is still in it's very early stages and much of the work is experimental. I will describe here some of the hardships I had to overcome in the process, hopefully it might save some other people's time.

So.... Let's dive right into the WEE BUFETS (Warnings,Errors, Exceptions, Bugs, Unanticipated results, Features, and other Excrements of Toxic Software)

Convert string to file handle:
Here's one sucker I had to deal with yesterday. It goes a little something like this:
Let's say you have a string which is a binary buffer holding the contents of a file. You want to
convert it to a file handle but you don't want to go through the trouble of of writing it to a file and then opening it and getting the file handle. You can do this using the following python code:
import StringIO
f = StringIO.StringIO("string containing file data")

That's it! now you can treat f as a regular file handle much the same way you would after a call to the 'open' function - I encountered this when I saved an image file in a mysql DB as a blob object, then reading from the database.

No comments:

Post a Comment