Re: Image processing libraries in python
On 14/09/18 19:04, tejaswi wrote: Hello everyone, I was looking to work with images in python. I saw two packages related to this, Pillow and scipy.ndimage. I was wondering what purposes each of these serve. I've previously used matlab/octave's image processing facilities and found them quite easy to work with, so is scipy the way to go in that case. Thank you, Tejaswi D Prakash Pillow is great for simple image processing. Converting between formats, resizing, cropping, rotating. simple filters - that kind of thing. The kind of thing you might otherwise do with GIMP, you might say. For more in-depth image analysis, scipy.ndimage and scikit-image are your friends. Obviously they work better with the numpy/scipy ecosystem. And, as MRAB points out, there's also OpenCV, which is fantastic for certain types of problems (have a look at the docs). For some fields (e.g. astronomy) there are also more specialized packages that may help. In short, if you images are pictures, have a look at Pillow. If your images are data, have a look at scikit-image, scipy.ndimage, and maybe more specialized packages like OpenCV or astropy. -- Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: Image processing libraries in python
On 2018-09-14 18:04, tejaswi wrote: Hello everyone, I was looking to work with images in python. I saw two packages related to this, Pillow and scipy.ndimage. I was wondering what purposes each of these serve. I've previously used matlab/octave's image processing facilities and found them quite easy to work with, so is scipy the way to go in that case. Depending on that you want to do, there's also OpenCV. -- https://mail.python.org/mailman/listinfo/python-list
Re: image in db to string to actual image
And what is your database? Maybe there is an API for the blob field On 08/02, Abdur-Rahmaan Janhangeer wrote: storing images in db is easy but to retrieve them natively how to? (ignore db type, using orm). meaning without PIL / Pillow. type : png like i'd like to have it as string, any idea ? Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list -- Stéphane Wirtel - https://wirtel.be - @matrixise -- https://mail.python.org/mailman/listinfo/python-list
Re: image in db to string to actual image
no not ascii art, just an application as described. thank you very much ! Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius On Fri, 3 Aug 2018, 07:45 Gilmeh Serda, wrote: > On Thu, 02 Aug 2018 20:35:01 +0400, Abdur-Rahmaan Janhangeer wrote: > > > ah those can be used, thanks, and to write the actual image? > > pseudo code: > > store_to_whatever(path2bin): > my_storage.store(uuencode(path2bin)) > > get_image_from_storage(path2uue): > return uudecode(my_storage.read(path2uue)) > > RTM on uue and its siblings. > > Nb with uue you have to make about 30-40% more room for storage, yEnc is > the smallest, only adds about 5-10% to the output. I believe Mime/Base64 > is somewhere in between. > > Just thought of something: you didn't mean to interpret the image as > ASCII art, did you? UUE and stuff, are not for that. > > In that case, look into the software Jave (Java based). I think it might > be open source. > > -- > Gilmeh > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: image in db to string to actual image
ah those can be used, thanks, and to write the actual image? On Thu, Aug 2, 2018 at 8:20 PM Gilmeh Serda wrote: > On Thu, 02 Aug 2018 17:24:29 +0400, Abdur-Rahmaan Janhangeer wrote: > > > like i'd like to have it as string, any idea ? > > UUEncode / Base64 / yEnc ...? > > -- > Gilmeh > -- > https://mail.python.org/mailman/listinfo/python-list > -- Abdur-Rahmaan Janhangeer https://github.com/abdur-rahmaanj Mauritius -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
Am 22.05.16 um 22:19 schrieb Random832: On Sun, May 22, 2016, at 15:37, Michael Torrie wrote: The reference is indeed held by the label but the problem is the label is a Tcl/Tk object, thinly wrapped in Python. Okay but then in that case why doesn't the image get instantiated as a Tcl/Tk object which the label holds a reference to and then nobody cares if the python image object gets collected? Actually, I think it could be solved, and not too complicated either. In Tk, objects are deleted explicitly. This is how you'd do it natively: image create photo bla -file myicon.png # create an image called "bla" pack [label .l -image bla] # display it in a label with name .l Of course, the label references the image object. For instance, if you read in new image data bla read newicon.png -shrink then the label will update. What happens, when you create all those things from Tkinter, the Label object deletes the image in it's destructor: image delete bla # this will turn the label blank This is IMHO correct, but when you add an image to the label through Tkinter, then it only does it through Tk (i.e. the second line in the above code). It should store a reference the Python image object inside the label object. This is akin to a "dangling pointer" in C. It would just be some work to replicate this for all widgets in Tk, there are buttons etc. but in essence I think it would work. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
On Sun, May 22, 2016, at 15:37, Michael Torrie wrote: > The reference is indeed held by the label but the problem is the label > is a Tcl/Tk object, thinly wrapped in Python. Okay but then in that case why doesn't the image get instantiated as a Tcl/Tk object which the label holds a reference to and then nobody cares if the python image object gets collected? (And anyway maybe the wrappers shouldn't be so thin if it causes problems like these.) -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
On 05/21/2016 01:55 PM, Random832 wrote: > On Sat, May 21, 2016, at 12:54, Peter Otten wrote: >> It's not your fault, there's an odd quirk in the library: you have to >> keep a reference of the PhotoImage instance around to prevent the >> image from being garbage-collected. > > Just out of curiosity, why is this a "quirk" and not a bug? Why isn't > the reference held by the Label? The reference is indeed held by the label but the problem is the label is a Tcl/Tk object, thinly wrapped in Python. It's essentially an impedance mismatch between two different languages and object models that each do their own reference holding and counting. I've run into this issue with PySide also as one is instantiating C++ objects that do their own internal reference counting through the Python wrapper. I'm sure Python wrappers could try to correct for this somewhat, but it's not a trivial thing to solve by any means. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
Random832 wrote: > On Sat, May 21, 2016, at 12:54, Peter Otten wrote: >> It's not your fault, there's an odd quirk in the library: you have to >> keep a reference of the PhotoImage instance around to prevent the >> image from being garbage-collected. > > Just out of curiosity, why is this a "quirk" and not a bug? I agree that this is at least a usability bug, but I think someone with a clue (Fredrik Lundh?) wrote it that way intentionally. > Why isn't the reference held by the Label? I can only speculate: to avoid a tcl/python reference cycle? You might file a bug report and see what comes of it. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
Thanks so much! All of methods works! -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
On Sat, May 21, 2016, at 12:54, Peter Otten wrote: > It's not your fault, there's an odd quirk in the library: you have to > keep a reference of the PhotoImage instance around to prevent the > image from being garbage-collected. Just out of curiosity, why is this a "quirk" and not a bug? Why isn't the reference held by the Label? -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
On 5/21/2016 12:54 PM, Peter Otten wrote: sweating_...@yahoo.com wrote: I am working on an image project, and I can display my image in main(). I mean, I can load my image in my main(). Needless, it is awkward. I am trying to load my image with a function, but got an empty image window popped up, no image content loaded. Please take a look at code: rom Tkinter import * def load_img(win): img = PhotoImage(file="xxx.gif") Label(win, image=img).pack() win = Tk() load_img(win) win.mainloop() Somebody can help me out? Thanks! It's not your fault, there's an odd quirk in the library: you have to keep a reference of the PhotoImage instance around to prevent the image from being garbage-collected. For example from Tkinter import * def load_img(win): global img img = PhotoImage(file="xxx.gif") Label(win, image=img).pack() win = Tk() load_img(win) win.mainloop() will work because img is now a global that is not deleted until the script ends (but don't run the function twice -- then the first image will disappear). The usual procedure is to create an App class and make images attributes of the App instance. Then load_img would be a method and the first line would be 'self.img = ...'. One can also have a list of images, to use in a slide show, or a dict of images, so users can select. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
On 05/21/2016 08:22 AM, sweating_...@yahoo.com wrote: Hi All, I am working on an image project, and I can display my image in main(). I mean, I can load my image in my main(). Needless, it is awkward. I am trying to load my image with a function, but got an empty image window popped up, no image content loaded. Please take a look at code: rom Tkinter import * def load_img(win): img = PhotoImage(file="xxx.gif") Label(win, image=img).pack() win = Tk() load_img(win) win.mainloop() Somebody can help me out? Thanks! I believe this the problem (However It's been long since I used Tkinter, so be warned ... ): The function load_img creates a local variable named img which goes out of scope and is deleted immediately when the function returns. However, Tkinter needs you to keep that image around as long as the Label uses it. So, some solutions are: keep_me = [] # Global for keeping references to images def load_img(win): img = PhotoImage(file="xxx.gif") keep_me.append(img) Label(win, image=img).pack() or def load_img(win): img = PhotoImage(file="xxx.gif") Label(win, image=img).pack() return img saved_img = load_img(win) ... Gary Herron -- Dr. Gary Herron Professor of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
On Sat, 21 May 2016 08:22:41 -0700 (PDT), sweating_...@yahoo.com wrote: > > I am working on an image project, and I can display my image in > main(). I mean, I can load my image in my main(). Needless, it is > awkward. I am trying to load my image with a function, but got an > empty image window popped up, no image content loaded. Please take a > look at code: > > rom Tkinter import * > > def load_img(win): > img = PhotoImage(file="xxx.gif") > Label(win, image=img).pack() > > win = Tk() > load_img(win) > win.mainloop() > This seems to work: --- from Tkinter import Tk, PhotoImage, Label def load_img(win): img = PhotoImage(file="/home/peter/dow.gif") Label(win, image=img).pack() return img win = Tk() img = load_img(win) win.mainloop() --- I guess the problem was that the "img" created in load_img went out of scope and was deleted when load_img returned. I just tried the "return img" as an experiment to keep it from going out of scope; from a software-engineering standpoint this might be a gross kluge. Baffling? Personally, I never got past feeling generally bewildered in Tkinter-land, and now I use matplotlib for all my graphical needs. I had great hopes for PyGUI at one point, but I hear very little about it now. -- To email me, substitute nowhere->runbox, invalid->com. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image loading problem
sweating_...@yahoo.com wrote: > I am working on an image project, and I can display my image in main(). I mean, I can load my image in my main(). Needless, it is awkward. I am trying to load my image with a function, but got an empty image window popped up, no image content loaded. Please take a look at code: > > > > rom Tkinter import * > > def load_img(win): > img = PhotoImage(file="xxx.gif") > Label(win, image=img).pack() > > win = Tk() > load_img(win) > win.mainloop() > > Somebody can help me out? Thanks! It's not your fault, there's an odd quirk in the library: you have to keep a reference of the PhotoImage instance around to prevent the image from being garbage-collected. For example from Tkinter import * def load_img(win): global img img = PhotoImage(file="xxx.gif") Label(win, image=img).pack() win = Tk() load_img(win) win.mainloop() will work because img is now a global that is not deleted until the script ends (but don't run the function twice -- then the first image will disappear). -- https://mail.python.org/mailman/listinfo/python-list
Re: Image download failure from wget.download function.
ashw...@nanoheal.com wrote: > I am trying to download the image from a URL, I am able to download a > file but after downloading if I try to open the image it says file format > is corrupted or damaged. What version of python are you using? Where did you get the wget libary? > I use this function to download the image - > wget.download('http:realpython.com//learn//python-first-steps//images//pythonlogo.jpg') The above snippet will not work because all slashes are duplicated. Please post a small but runnable script. > For all the other URLs also same image format failure is happening. How do you "open" the images? Do you mean you try to view them in an image viewer or are you reading the contents with Python? If the latter, show us your code for that, too. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image rotation issue
On Mon, Mar 30, 2015 at 3:22 PM, kai.pet...@gmail.com wrote: rotimg = img.rotate(270) # rotation is counterclockwise # i can almost make it work by resizing rotimg here, but the aspect ratio is then screwed #rotimg = rotimg.resize((1024, 1280)) rotimg.show() imagedata = list(rotimg.getdata()) But grabbing data from the rotimg does not work as it does not seem to return an image with swapped dimensions... What am I missing? Have you tried passing the expand flag to rotate? http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.rotate I'm not sure if that will result in an image sized (1280, 1024) or (1280, 1280). If the latter, you should be able to fix it using Image.crop. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image rotation issue
On Tue, Mar 31, 2015 at 8:22 AM, kai.pet...@gmail.com wrote: rotimg = img.rotate(270) # rotation is counterclockwise Unless the 90 and 270 cases are documented as being handled specially, I'd look for a dedicated function for doing those changes. A quick perusal of the docs showed up this: http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.transpose Is that any better, or is that doing the exact same thing as rotate()? By the way: The black white only device (1024 (X) x 1280 (Y)) expects the compressed data based on portrait mode, i.e. 8 pixels combined into one bytes for 1280 rows of 128 bytes. This sounds to me like the fax standard. I wonder, can you make use of a TIFF library to do some of your work for you? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Image rotation issue
On Monday, 30 March 2015 16:48:08 UTC-7, Chris Angelico wrote: On Tue, Mar 31, 2015 at 8:22 AM, duderino wrote: rotimg = img.rotate(270) # rotation is counterclockwise Unless the 90 and 270 cases are documented as being handled specially, I'd look for a dedicated function for doing those changes. A quick perusal of the docs showed up this: http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.transpose Is that any better, or is that doing the exact same thing as rotate()? By the way: The black white only device (1024 (X) x 1280 (Y)) expects the compressed data based on portrait mode, i.e. 8 pixels combined into one bytes for 1280 rows of 128 bytes. This sounds to me like the fax standard. I wonder, can you make use of a TIFF library to do some of your work for you? ChrisA According to the docs rotate transform can both be used and should do the same in my case - but they are not. rotimg = img.transpose(Image.ROTATE_270) print img.getbbox() print rotimg.getbbox() gives (0, 0, 1280, 1024) (0, 0, 1024, 1280) while rotimg = img.rotate(270, 0, 1) print img.getbbox() print rotimg.getbbox() gives (0, 0, 1280, 1024) (1, 1, 1025, 1281) Neither one produces good output when the compression is applied. Don't think it's related to fax standards - it's proprietary (E-Ink Tile) -- https://mail.python.org/mailman/listinfo/python-list
Re: Image rotation issue
On Tue, Mar 31, 2015 at 3:04 PM, high5stor...@gmail.com wrote: Neither one produces good output when the compression is applied. Oh well, was worth a try. Don't think it's related to fax standards - it's proprietary (E-Ink Tile) Doesn't need to be specifically _related_, but it's looking similar. If you could do 90% of your work by pretending that this is a fax you're sending, you could possibly do the other 10% by snagging a byte stream from somewhere. But maybe not worth hunting down. Just a thought. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Image Upload with FalconFramework
On 03/07/2014 04:54, Peter Romfeld wrote: Hi, I am stuck at a simple image upload function, in django i just used: for feature phones: file = request.body iOS with Form: class ImageForm(forms.Form): image = forms.FileField() What is forms? image is defined at the class level, not the instance level, did you actually mean that? form = ImageForm(request.POST, request.FILES) file = request.FILES['image'].read() file has been overwritten. with falcon i tried but not working; req.stream.read() req is undefined here. Cheers, Peter So please give us your OS and Python versions, the exact code that you've tried to run, how you've tried to run it, what you expected to happen and what actually happened including the complete traceback if any. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: image processing in python and opencv
On Sunday, March 9, 2014 2:09:25 PM UTC-5, Gary Herron wrote: i have no idea how to retrieve indexed images stored in ordered dictionary, using its values like : blue,green,red mean along with contrast, energy, homogeneity and correlation. as i have calculated the euclidean distance and i don't know how to display the images which are similar. Its a bot. (spam) -- https://mail.python.org/mailman/listinfo/python-list
Re: image processing in python and opencv
On 03/09/2014 10:56 AM, Varsha Holla wrote: i have no idea how to retrieve indexed images stored in ordered dictionary, using its values like : blue,green,red mean along with contrast, energy, homogeneity and correlation. as i have calculated the euclidean distance and i don't know how to display the images which are similar. thanks in advance Sorry, but is there a question here? And is it Python related? (This is a Python list, right?) And while you're rewording this as a Python related question, please take the time to state the problem clearly. You'll get more help if you take the time to tell us what you are doing. For instance: You have a dictionary. How was it created? What values are stored in it? What keys were used? Why is it an ordered dictionary? Is your trouble retrieving images, computing keys for similar images, or displaying images? (All three seem to be implied above.) Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
First helpful advice i have gotten from this forum -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
On Tue, 08 Oct 2013 07:15:46 -0700, markotaht wrote: First helpful advice i have gotten from this forum If you insist on dropping cryptic comments with bad spelling, incoherent sentences, and a complete lack of any context, it might be the last advice you get too. Please help us to help you. We are not mind readers, we cannot read your mind and magically understand what you are talking about. Please include content when replying to an posts. Please take the time to try to explain your questions, with proper grammar and syntax and spelling. We will make allowances if English is not your native language, but we won't make allowances if you are just being lazy. Please show small code snippets that demonstrate the problem. You should read this site: even though it is written for Java, the basic ideas hold for Python as well. http://sscce.org Remember that we are volunteers and we are not being paid to help you. The harder you make it for us to understand your posts, the less likely we are to solve your problem. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
teisipäev, 8. oktoober 2013 17:26.33 UTC+3 kirjutas Steven D'Aprano: On Tue, 08 Oct 2013 07:15:46 -0700, markotaht wrote: First helpful advice i have gotten from this forum If you insist on dropping cryptic comments with bad spelling, incoherent sentences, and a complete lack of any context, it might be the last advice you get too. Please help us to help you. We are not mind readers, we cannot read your mind and magically understand what you are talking about. Please include content when replying to an posts. Please take the time to try to explain your questions, with proper grammar and syntax and spelling. We will make allowances if English is not your native language, but we won't make allowances if you are just being lazy. Please show small code snippets that demonstrate the problem. You should read this site: even though it is written for Java, the basic ideas hold for Python as well. http://sscce.org Remember that we are volunteers and we are not being paid to help you. The harder you make it for us to understand your posts, the less likely we are to solve your problem. -- Steven Well english isnt my native language, and there are things i just dont know how to explain in any language. And i cant give all the codes i am using, since there are loads of pieces i do not own, but i know the people who made them. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
I rembembered a bit too late, are there any good tutorials for Pillow? ImageTk.PhotoImage() keeps giving me error that there isnt such a method. -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
Image consists of pixels. Each pixel has its RGBA values. In python whidout any extra downloadable modules, is there a way to get those values. I know PIG has it but i hav Python 3.3.2 so PIG wont do. In java under swingx there is a command called .getRGB() and whit some manipulation to that value i can get the R G B and A. Is there something similar in python? -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
On Sun, Oct 6, 2013 at 3:19 PM, markot...@gmail.com wrote: Image consists of pixels. Each pixel has its RGBA values. In python whidout any extra downloadable modules, is there a way to get those values. I know PIG has it but i hav Python 3.3.2 so PIG wont do. PIG? Did you mean PIL? In that case, go use Pillow, the Python 3-compatible fork. -- Chris “Kwpolska” Warrick http://kwpolska.tk PGP: 5EAAEA16 stop html mail | always bottom-post | only UTF-8 makes sense -- https://mail.python.org/mailman/listinfo/python-list
Re: Image manipulation
On 10/04/2013 03:52 AM, markot...@gmail.com wrote: Is there a way using the python 3.3.2 whidout any additional downloaded moduls, to get a pixels RGB value? No (I guess). If you want a better answer, then you'll have to give us a *much* better question. Get a pixel from *what*? (screen? image on disk? image on web page? printed image on paper? ...?) On what operating system? Using what kind of a graphics/imaging hardware/software? How are said pixels being written? Please understand how broad the term pixel is and how little information your question has provided. Try again with a full description of what you want, and we'll try to provide a useful answer. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
Re: Image processing to auto adjust colors in python ?
On Mon, 16 May 2011 10:11:43 -0700, goldtech wrote: I'm processing thumbnails with python but one thing I need to do is to auto-adjust an image for the best colors. I am using ffmpeg to get thumbs three seconds into a video, sometimes the image is too dark. Normally I'd go into something like the windows program Irfan View and do Auto Adjust Colors, but I need a comand-line solution to processes hundreds of images in a loop. I'm using Ubuntu and Python. Is there an image precessing package i could use to do this? PIL (Python Imaging Library) is the most widely-used general-purpose image library. For more advanced tasks, the usual solution is to use PIL to load/save images and do the processing with NumPy/SciPy (array-processing library). But you might want to check whether either ImageMagick (e.g. convert -equalize ...) or NetPBM (e.g. pnmhisteq) do what you want. If they do, it will probably be the simplest solution. -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
In article mailman.1399.1280702057.1673.python-l...@python.org, Chris Hare ch...@labr.net wrote: And I see now what I did wrong - thanks for putting up with the questions. Posting that information is useful for any other newbies who might be following along -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ ...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box. --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list
Re: Image histogram
Yes, my question is regarding PIL. And basically I need to reload an image given a new histogram. The new histogram has still the same amount of overall pixels however I have only switched a couple of picks. Another thing I have tried was using a function that could be given to the point module but problem with that was that I didnt want to apply the function to every single count in the histogram. I only need to change two or three picks there. Is this something that could be done with PIL modules at all? Thank you and sorry for the confusion, Anahita On Mon, Aug 9, 2010 at 4:27 PM, Anahita Yazdi atya...@ucdavis.edu wrote: Hi, I was just wondering how would I be able to get some extra help regarding editing an image's histogram using python's module? I have modified a histogram of an image however I dont know how to apply the new histogram to the image and basically reload the image based on its new modified histogram instead of its own histogram? In the other words how should I make changes on an image's histogram in a way that the image recognizes the new histogram and gets changed? I need to somehow introduce a LUT for the image and use .point(table) function to reload the image however I am not sure how to make the right LUT from a modified histogram! Thanks for the help in advance, Anahita -- http://mail.python.org/mailman/listinfo/python-list
Re: Image histogram
On 08/09/2010 04:27 PM, Anahita Yazdi wrote: Hi, I was just wondering how would I be able to get some extra help regarding editing an image's histogram using python's module? I have modified a histogram of an image however I dont know how to apply the new histogram to the image and basically reload the image based on its new modified histogram instead of its own histogram? In the other words how should I make changes on an image's histogram in a way that the image recognizes the new histogram and gets changed? I need to somehow introduce a LUT for the image and use .point(table) function to reload the image however I am not sure how to make the right LUT from a modified histogram! Thanks for the help in advance, Anahita This is a Python newsgroup, not an image processing news group. If you are asking for an algorithm to modify an image -- then you are on the wrong list, and you'd be better off asking on some image processing news group. If, on the other hand, you have an image processing algorithm in mind, then tell us about the algorithm, and we'll discuss how to implement it in Python. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: Image histogram
Gary Herron gher...@islandtraining.com writes: This is a Python newsgroup, not an image processing news group. If you are asking for an algorithm to modify an image I saw it as a question of how to do something using PIL. Seems ok to me. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image histogram
On 08/09/2010 05:02 PM, Paul Rubin wrote: Gary Herrongher...@islandtraining.com writes: This is a Python newsgroup, not an image processing news group. If you are asking for an algorithm to modify an image I saw it as a question of how to do something using PIL. Seems ok to me. A quote from the OP: however I dont know how to apply the new histogram to the image PIL has no such operation. I have no knowledge of any such operation. And frankly, I'm having a hard time imagining what apply a histogram to the image even means. (For instance if the original histogram says there are 30 pixels with some value, and the new histogram says there should be 20 pixels with that value -- which 10 do I replace, and with what do I replace them?) We can help him use PIL to read, manipulate, and write an image. But the actual manipulation he is requesting is so far unspecified. So I'll repeat: If he is looking for an algorithm -- I haven't got one. If he has an algorithm -- tell us about it, and we'll discuss implementing it in Python. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
On Aug 1, 7:35 am, Chris Hare ch...@labr.net wrote: I have the following chunk of code. Although it seems to execute fine, no errors Not True! it contains syntax errors. Check the posted code and next time post all the code. -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
On Aug 1, 2010, at 10:24 AM, rantingrick wrote: On Aug 1, 7:35 am, Chris Hare ch...@labr.net wrote: I have the following chunk of code. Although it seems to execute fine, no errors Not True! it contains syntax errors. Check the posted code and next time post all the code. -- http://mail.python.org/mailman/listinfo/python-list Hmmm... ok here is the code. I get no errors on my console when it execute urllib.urlretrieve(findu, image.png) logging.debug(createRadarWidgets(): radar download complete) logging.debug(createRadarWidgets(): user has radarPanelSize of + root.radarPanelSize.get()) # # open the image file # if os.path.exists(image.gif): ctime = os.stat(dbPath)[ST_CTIME] print ctime filetime = datetime.fromtimestamp(ctime) filetime = filetime.strftime(%Y%m%d%H%M%S) print str(filetime) #filetime = datetime(ctime).isoformat() #print ctime imagePNG = Image.open(image.png) #photo = ImageTk.PhotoImage(imagePNG) Image.open(image.png).save(image.gif) image = Image.open(image.gif) photo = PhotoImage(file=image.gif) #photoimg = ImageTk.PhotoImage(photo) # # NOTE: - will want to track the size of the image displayed based upon # the actual screen resolution # Full/External = 600x550 - full file size # Large = 450x412 # Medium = 300x275 # Small = 150x137 # if root.radarPanelSize.get() == Large: canvasWidth = 450 canvasHeight = 412 elif root.radarPanelSize.get() == Medium: canvasWidth = 300 canvasHeight = 275 elif root.radarPanelSize.get() == Small: canvasWidth = 150 canvasHeight = 137 logging.debug(createRadarWidgets(): creating image size + str(canvasWidth) + x + str(canvasHeight)) # # create a canvas of the appropriate size for the image # w = Canvas(f, width=canvasWidth, height=canvasHeight) if root.radarPanelSize.get() == Off: logging.debug(createRadarWidgets(): no net, no radar) netRadarImage = Label(w, text=No current radar) else: # # convert it into a photo item we can use in the display # # photo = photo.resize((canvasWidth,canvasHeight),Image.ANTIALIAS) netRadarImage = Label(w, image=photo) netRadarImage.image = photo w.grid(row=1, column=0, columnspan=3) netRadarImage.grid( row=1, column=0) -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
Chris Hare wrote: On Aug 1, 2010, at 10:24 AM, rantingrick wrote: On Aug 1, 7:35 am, Chris Hare ch...@labr.net wrote: I have the following chunk of code. Although it seems to execute fine, no errors Not True! it contains syntax errors. Check the posted code and next time post all the code. -- http://mail.python.org/mailman/listinfo/python-list Hmmm... ok here is the code. I get no errors on my console when it execute urllib.urlretrieve(findu, image.png) I get a NameError on the very first line. urllib.urlretrieve(findu, image.png) Traceback (most recent call last): File stdin, line 1, in module NameError: name 'urllib' is not defined When you want to demonstrate a problem try to make a self-contained example, i. e. one that can be run without the need for us guess the surrounding code. Remove everything that is irrelevant for the problem like the logging in code below and the png/gif conversion gymnastics. Anyway, here is a self-contained demo (you have to pass the filename of an image on the commandline): import Tkinter import ImageTk import Image import sys [filename] = sys.argv[1:] image = Image.open(filename) root = Tkinter.Tk() frame = Tkinter.Frame(root) frame.pack() label = Tkinter.Label(root) label.pack() def make_resize(percent): def resize(): width, height = image.size label.image = label[image] = ImageTk.PhotoImage( image=image.resize((width*percent//100, height*percent//100))) return resize make_resize(100)() pairs = [ (Small, 20), (Medium, 50), (Original, 100), (Big, 200)] for i, (text, percent) in enumerate(pairs): button = Tkinter.Button(frame, text=text, command=make_resize(percent)) button.grid(row=0, column=i) root.mainloop() Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
On Aug 1, 2010, at 1:08 PM, Peter Otten wrote: Chris Hare wrote: On Aug 1, 2010, at 10:24 AM, rantingrick wrote: On Aug 1, 7:35 am, Chris Hare ch...@labr.net wrote: I have the following chunk of code. Although it seems to execute fine, no errors Not True! it contains syntax errors. Check the posted code and next time post all the code. -- http://mail.python.org/mailman/listinfo/python-list Hmmm... ok here is the code. I get no errors on my console when it execute urllib.urlretrieve(findu, image.png) I get a NameError on the very first line. urllib.urlretrieve(findu, image.png) Traceback (most recent call last): File stdin, line 1, in module NameError: name 'urllib' is not defined When you want to demonstrate a problem try to make a self-contained example, i. e. one that can be run without the need for us guess the surrounding code. Remove everything that is irrelevant for the problem like the logging in code below and the png/gif conversion gymnastics. Anyway, here is a self-contained demo (you have to pass the filename of an image on the commandline): import Tkinter import ImageTk import Image import sys [filename] = sys.argv[1:] image = Image.open(filename) root = Tkinter.Tk() frame = Tkinter.Frame(root) frame.pack() label = Tkinter.Label(root) label.pack() def make_resize(percent): def resize(): width, height = image.size label.image = label[image] = ImageTk.PhotoImage( image=image.resize((width*percent//100, height*percent//100))) return resize make_resize(100)() pairs = [ (Small, 20), (Medium, 50), (Original, 100), (Big, 200)] for i, (text, percent) in enumerate(pairs): button = Tkinter.Button(frame, text=text, command=make_resize(percent)) button.grid(row=0, column=i) root.mainloop() Peter -- http://mail.python.org/mailman/listinfo/python-list Thanks for the help. My one week of python is getting a workout. I have shortened it all down and made it a standalone example, using yours as a model. Your example, works, but it will take a lot of effort to retrofit it into the code I have. (which is maybe not a bad idea,). Anyway from Tkinter import * import ImageTk import Image import sys def sizeit(filename): image = Image.open(filename) w,h = image.size print w, h photo = ImageTk.PhotoImage(file=filename) canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth,canvasHeight),Image.ANTIALIAS) w,h = image.size print w, h netRadarImage = Label(frame, image=image) netRadarImage.image = photo w.grid(row=1, column=0, columnspan=3) netRadarImage.grid( row=1, column=0) [filename] = sys.argv[1:] root = Tk() frame = Frame(root) frame.grid() sizeit(filename) root.mainloop() Just like yours it takes a filename. Unlike yours, mine gets an error that I can't figure out and is likely the root of the problem. When I run this code I get 600 550 == ORIGINAL image size 450 412 == resized image size Traceback (most recent call last): File zztest.py, line 26, in module sizeit(filename) File zztest.py, line 16, in sizeit netRadarImage = Label(frame, image=image) File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py, line 2466, in __init__ Widget.__init__(self, master, 'label', cnf, kw) File /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py, line 1932, in __init__ (widgetName, self._w) + extra + self._options(cnf)) _tkinter.TclError: image Image.Image image mode=P size=450x412 at 0x1016095A8 doesn't exist So, my problem appeared to be the resize, but in fact is just getting it onto the label. What am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
Chris Hare wrote: Thanks for the help. My one week of python is getting a workout. I have shortened it all down and made it a standalone example, using yours as a model. Your example, works, but it will take a lot of effort to retrofit it into the code I have. (which is maybe not a bad idea,). You mean retrofit something that works into something tha doesn't? Seriously, you should never be afraid to throw away code, especially while you're still in the early phase of learning the language. def sizeit(filename): image = Image.open(filename) Now you have an Image w,h = image.size print w, h photo = ImageTk.PhotoImage(file=filename) and now a photo, both created from the same file but otherwise independent canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth,canvasHeight),Image.ANTIALIAS) Now you have a new resized Image w,h = image.size print w, h netRadarImage = Label(frame, image=image) Label(image=...) expects a PhotoImage netRadarImage.image = photo w.grid(row=1, column=0, columnspan=3) Hmm... netRadarImage.grid( row=1, column=0) Here's the fixed code: def sizeit(filename): image = Image.open(filename) canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth, canvasHeight),Image.ANTIALIAS) photo = ImageTk.PhotoImage(image=image) netRadarImage = Label(frame, image=photo) netRadarImage.image = photo netRadarImage.grid(row=0, column=0) In plain English: - open the Image using the PIL - resize it - wrap it into a PhotoImage - wrap the PhotoImage into a Tkinter.Label either by passing it to the initialiser or by assigning to label[image] - make sure the PhotoImage isn't garbage-collected e. g. by assigning to label.image Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
And I see now what I did wrong - thanks for putting up with the questions. On Aug 1, 2010, at 4:32 PM, Peter Otten wrote: Chris Hare wrote: Thanks for the help. My one week of python is getting a workout. I have shortened it all down and made it a standalone example, using yours as a model. Your example, works, but it will take a lot of effort to retrofit it into the code I have. (which is maybe not a bad idea,). You mean retrofit something that works into something tha doesn't? Seriously, you should never be afraid to throw away code, especially while you're still in the early phase of learning the language. def sizeit(filename): image = Image.open(filename) Now you have an Image w,h = image.size print w, h photo = ImageTk.PhotoImage(file=filename) and now a photo, both created from the same file but otherwise independent canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth,canvasHeight),Image.ANTIALIAS) Now you have a new resized Image w,h = image.size print w, h netRadarImage = Label(frame, image=image) Label(image=...) expects a PhotoImage netRadarImage.image = photo w.grid(row=1, column=0, columnspan=3) Hmm... netRadarImage.grid( row=1, column=0) Here's the fixed code: def sizeit(filename): image = Image.open(filename) canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth, canvasHeight),Image.ANTIALIAS) photo = ImageTk.PhotoImage(image=image) netRadarImage = Label(frame, image=photo) netRadarImage.image = photo netRadarImage.grid(row=0, column=0) In plain English: - open the Image using the PIL - resize it - wrap it into a PhotoImage - wrap the PhotoImage into a Tkinter.Label either by passing it to the initialiser or by assigning to label[image] - make sure the PhotoImage isn't garbage-collected e. g. by assigning to label.image Peter -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: image resize doesn't work
Thanks Peter - I know what I said sounded stupid :-) I have been working with Python for a week and as you know sometimes it is easier to learn by seeing what you did wrong as compared to what should have been done with the same example. I loved your code by the way - Thanks for help just another beginner On Aug 1, 2010, at 4:32 PM, Peter Otten wrote: Chris Hare wrote: Thanks for the help. My one week of python is getting a workout. I have shortened it all down and made it a standalone example, using yours as a model. Your example, works, but it will take a lot of effort to retrofit it into the code I have. (which is maybe not a bad idea,). You mean retrofit something that works into something tha doesn't? Seriously, you should never be afraid to throw away code, especially while you're still in the early phase of learning the language. def sizeit(filename): image = Image.open(filename) Now you have an Image w,h = image.size print w, h photo = ImageTk.PhotoImage(file=filename) and now a photo, both created from the same file but otherwise independent canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth,canvasHeight),Image.ANTIALIAS) Now you have a new resized Image w,h = image.size print w, h netRadarImage = Label(frame, image=image) Label(image=...) expects a PhotoImage netRadarImage.image = photo w.grid(row=1, column=0, columnspan=3) Hmm... netRadarImage.grid( row=1, column=0) Here's the fixed code: def sizeit(filename): image = Image.open(filename) canvasWidth = 450 canvasHeight = 412 image = image.resize((canvasWidth, canvasHeight),Image.ANTIALIAS) photo = ImageTk.PhotoImage(image=image) netRadarImage = Label(frame, image=photo) netRadarImage.image = photo netRadarImage.grid(row=0, column=0) In plain English: - open the Image using the PIL - resize it - wrap it into a PhotoImage - wrap the PhotoImage into a Tkinter.Label either by passing it to the initialiser or by assigning to label[image] - make sure the PhotoImage isn't garbage-collected e. g. by assigning to label.image Peter -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: image processing - inverse filtering
In article 5bfefbb6-89a8-49f6-9f02-7d36dfbc0...@c29g2000yqd.googlegroups.com, suresh.amritapuri suresh.amritap...@gmail.com wrote: If I am using scipy.ndimage.gaussian_filter() for filtering an image, how to do the inverse filtering? In general how to do this using scipy.ndimage? http://projects.scipy.org/mailman/listinfo/scipy-user -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list
Re: Image to SVG conversion with Python
Carlo DiCelico wrote: I need to convert JPEG and PNG files to SVG. I'm currently using PIL to generate the JPEG/PNG files to begin with. However, I need to be able to scale the generated images up in size without a loss of image quality. Using SVG seems to be the best way to do this, other than generating the images in the maximum size/resolution in the first place, which would be too resource intensive. I've looked around online and have found some tools for creating SVGs but none for converting an image into SVG. Does anyone have any experience doing this? What would be the best way to go about this? Thanks, Carlo I have no direct experience with SVG, but have used and analyzed other formats. I expect it's unreasonable to convert jpg or png files to SVG. The latter is a vector format, and can't efficiently represent pixels, which is all you have in the jpg files. And even if you did it brute force, it still wouldn't scale any better than the original jpg. If the jpg file was generated from lines, and wasn't too crowded, it *might* be possible to analyze it to reconstruct the vectors, but it would be both very slow, and inaccurate. In Photoshop PSD files, you can have vector layers and RGB layers (plus other kinds). You convert a vector layer (such as text) to bits by rasterizing (or flattening). And once you do, it no longer scales cleanly. For instance, when I'm sending composite images to a printer, I get much better quality sending the raster portion separate from the text, either as layers in a PSD file, or in a PDF file, or even as two separate files that they will merge later. (In that case, I usually send a low-res flattened file, so they can see how it's supposed to look) I'd say you should change your python code to generate the svg files first (perhaps using http://code.activestate.com/recipes/325823/ ) Then you might want to use ( http://www.imagemagick.org/script/index.php ) to convert it to jpg or other format. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Image to SVG conversion with Python
On Nov 16, 11:48 am, Dave Angel da...@ieee.org wrote: Carlo DiCelico wrote: I need to convert JPEG and PNG files to SVG. I'm currently using PIL to generate the JPEG/PNG files to begin with. However, I need to be able to scale the generated images up in size without a loss of image quality. Using SVG seems to be the best way to do this, other than generating the images in the maximum size/resolution in the first place, which would be too resource intensive. I've looked around online and have found some tools for creating SVGs but none for converting an image into SVG. Does anyone have any experience doing this? What would be the best way to go about this? Thanks, Carlo I have no direct experience with SVG, but have used and analyzed other formats. I expect it's unreasonable to convert jpg or png files to SVG. The latter is a vector format, and can't efficiently represent pixels, which is all you have in the jpg files. And even if you did it brute force, it still wouldn't scale any better than the original jpg. If the jpg file was generated from lines, and wasn't too crowded, it *might* be possible to analyze it to reconstruct the vectors, but it would be both very slow, and inaccurate. In Photoshop PSD files, you can have vector layers and RGB layers (plus other kinds). You convert a vector layer (such as text) to bits by rasterizing (or flattening). And once you do, it no longer scales cleanly. For instance, when I'm sending composite images to a printer, I get much better quality sending the raster portion separate from the text, either as layers in a PSD file, or in a PDF file, or even as two separate files that they will merge later. (In that case, I usually send a low-res flattened file, so they can see how it's supposed to look) I'd say you should change your python code to generate the svg files first (perhaps usinghttp://code.activestate.com/recipes/325823/) Then you might want to use (http://www.imagemagick.org/script/index.php ) to convert it to jpg or other format. DaveA Thanks, this makes perfect sense. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image to SVG conversion with Python
On Mon, 16 Nov 2009 07:19:49 -0800, Carlo DiCelico wrote: I need to convert JPEG and PNG files to SVG. I'm currently using PIL to generate the JPEG/PNG files to begin with. However, I need to be able to scale the generated images up in size without a loss of image quality. Using SVG seems to be the best way to do this, other than generating the images in the maximum size/resolution in the first place, which would be too resource intensive. I've looked around online and have found some tools for creating SVGs but none for converting an image into SVG. Does anyone have any experience doing this? What would be the best way to go about this? JPEG/PNG are raster formats, SVG is a vector format. To convert raster graphics to vector graphics, you need a tracing program (aka image tracing, vector tracing, vectorizing), e.g. potrace (this program is often bundled with InkScape): http://potrace.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: [Image-SIG] Some issue with easy_install and PIL/Imaging
The problem is that too many people arguing for eggs do this by sending nastygrams, which doesn't really provide much motivation for doing anything about it (I don't do asshole-driven development). The public review PIL got a couple a minutes ago matches some of the private mail I've gotten: no egg - worst seen ever, remove it from pypi or provide an egg (jensens, 2009-10-05, 0 points) /F On Wed, Sep 30, 2009 at 6:24 PM, Chris Withers ch...@simplistix.co.uk wrote: Fredrik Lundh wrote: On Fri, Sep 11, 2009 at 3:49 PM, Chris Withers ch...@simplistix.co.uk wrote: Klein Stéphane wrote: Resume : 1. first question : why PIL package in pypi don't work ? Because Fred Lundh have his package distributions unfortunate names that setuptools doesn't like... It used to support this, but no longer does. To me, that says more about the state of setuptools than it does about the state of PIL, which has been using the same naming convention for 15 years. Yep, but it is now in the minority, and consistency in package naming is always good. Would there be any problems for you in naming the distribution in a setuptools-friendly way from the next point release? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: [Image-SIG] Some issue with easy_install and PIL/Imaging
Fredrik Lundh wrote: The problem is that too many people arguing for eggs do this by sending nastygrams, which doesn't really provide much motivation for doing anything about it (I don't do asshole-driven development). Indeed, I couldn't agree more, and I'm sorry you've been subjected to this. My (hopefully more polite) request still stands though: Would there be any problems for you in naming the distribution in a setuptools-friendly way from the next point release? The public review PIL got a couple a minutes ago matches some of the private mail I've gotten: no egg - worst seen ever, remove it from pypi or provide an egg (jensens, 2009-10-05, 0 points) *sigh* Interesting timing, myself and Doug Hellmann have been trying to persuade Martin von Lewis that while ratings are fine, the commenting system is likely to be abused: https://sourceforge.net/tracker/?func=detailatid=513503aid=2866081group_id=66150 https://sourceforge.net/tracker/?func=detailatid=513503aid=2872293group_id=66150 I'll put in a request to have that comment removed... Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: [Image-SIG] Some issue with easy_install and PIL/Imaging
Fredrik Lundh wrote: On Fri, Sep 11, 2009 at 3:49 PM, Chris Withers ch...@simplistix.co.uk wrote: Klein Stéphane wrote: Resume : 1. first question : why PIL package in pypi don't work ? Because Fred Lundh have his package distributions unfortunate names that setuptools doesn't like... It used to support this, but no longer does. To me, that says more about the state of setuptools than it does about the state of PIL, which has been using the same naming convention for 15 years. Yep, but it is now in the minority, and consistency in package naming is always good. Would there be any problems for you in naming the distribution in a setuptools-friendly way from the next point release? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: [Image-SIG] Some issue with easy_install and PIL/Imaging
On Fri, Sep 11, 2009 at 3:49 PM, Chris Withers ch...@simplistix.co.uk wrote: Klein Stéphane wrote: Resume : 1. first question : why PIL package in pypi don't work ? Because Fred Lundh have his package distributions unfortunate names that setuptools doesn't like... It used to support this, but no longer does. To me, that says more about the state of setuptools than it does about the state of PIL, which has been using the same naming convention for 15 years. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
On 1月7日, 上午4时14分, J Kenneth King ja...@agentultra.com wrote: I'm curious as to what application the solution to this problem is practical for all of its difficulty? Sorry, I oversimplified the question because of my poor english. It is an analog compass whose value we need to read into the computer every second. We use a video camera keep shooting it, and the compass and camera are fixed. -- Li Han -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
2009/1/7 Li Han lihang9...@gmail.com On 1月7日, 上午4时14分, J Kenneth King ja...@agentultra.com wrote: I'm curious as to what application the solution to this problem is practical for all of its difficulty? Sorry, I oversimplified the question because of my poor english. It is an analog compass whose value we need to read into the computer every second. We use a video camera keep shooting it, and the compass and camera are fixed. -- Li Han -- http://mail.python.org/mailman/listinfo/python-list The compass of the needle looks like a line. Lines can be best detected using second order (Gaussian) derivatives. scipy.ndimage.gaussian_filter provides a filter you can use for that. Then maybe PCA to find the direction of the needle, and you're done! There's probably more to it (there always is), but this might get you started. Almar -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
Li Han wrote: Sorry, I oversimplified the question because of my poor english. It is an analog compass whose value we need to read into the computer every second. We use a video camera keep shooting it, and the compass and camera are fixed. If you have any choice about it, it would be greatly simpler, cheaper, and more effective to throw out the camera and analog compass, and use an electronic compass instead. These are affordable and work quite well provided you keep them level (the same constraint you have with an old-fashioned compass too). You can make some simple interface hardware, or spend a bit more for something with a USB or serial interface built in, like this: http://www.oceanserver-store.com/osevkitsorus.html Best, - Joe -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
start with Python Image Library: http://www.pythonware.com/products/pil/ On Tue, Jan 6, 2009 at 4:28 PM, Li Han lihang9...@gmail.com wrote: Hi! I know little about the computer image processing, and now I have a fancy problem which is how to read the time from the picture of a clock by programming ? Is there anyone who can give me some suggestions? Thank! Li Han -- http://mail.python.org/mailman/listinfo/python-list -- Furkan Kuru -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
Hi, Furkan Kuru wrote: start with Python Image Library: http://www.pythonware.com/products/pil/ I think this is more a job for OpenCV and its python bindings. http://opencv.willowgarage.com/wiki/PythonInterface On Tue, Jan 6, 2009 at 4:28 PM, Li Han lihang9...@gmail.com mailto:lihang9...@gmail.com wrote: Hi! I know little about the computer image processing, and now I have a fancy problem which is how to read the time from the picture of a clock by programming ? Is there anyone who can give me some suggestions? Thank! Li Han Regards Tino smime.p7s Description: S/MIME Cryptographic Signature -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
Li Han liha@gmail.comwrote: Hi! I know little about the computer image processing, and now I have a fancy problem which is how to read the time from the picture of a clock by programming ? Is there anyone who can give me some suggestions? When the big hand is on the twelve, and the little hand is on the eight, it is eight O'clock... :-) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
2009/1/6 Hendrik van Rooyen m...@microcorp.co.za: Li Han liha@gmail.comwrote: Hi! I know little about the computer image processing, and now I have a fancy problem which is how to read the time from the picture of a clock by programming ? Is there anyone who can give me some suggestions? When the big hand is on the twelve, and the little hand is on the eight, it is eight O'clock... My clock is digital, you insensitive clod! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я ä-ö-ü-ß-Ä-Ö-Ü -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
Furkan start with Python Image Library: Furkan http://www.pythonware.com/products/pil/ Well, there's the little problem of optical character recognition. You might want to check out open source OCR tools like gocr: http://jocr.sourceforge.net/ Just use PIL to convert input images into PNM format, run gocr in a subprocess read the stdout to get text. -- Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
This was just mentioned on the KDE bugtracker: http://opencv.willowgarage.com/wiki/FaceDetection -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я ä-ö-ü-ß-Ä-Ö-Ü -- http://mail.python.org/mailman/listinfo/python-list
Re: image recogniton?
Li Han lihang9...@gmail.com writes: Hi! I know little about the computer image processing, and now I have a fancy problem which is how to read the time from the picture of a clock by programming ? Is there anyone who can give me some suggestions? Thank! Li Han I do work in object recognition, and I would classify this as a rather difficult problem. Not impossible of course, but you'll need some OCR to read the clock face and some sort of magnitude vector feature to tell which hand is which and the general direction is is pointing in. Also, depends if we're talking digital clocks or analog. :) The other problem is one of accuracy: depending on your input image, even slight variances can change your results. I'm curious as to what application the solution to this problem is practical for all of its difficulty? -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Processing (batch)
On Thu, 05 Jun 2008 07:10:56 +, Tim Roberts wrote: Thomas Guettler [EMAIL PROTECTED] wrote: I tried PIL for image batch processing. But somehow I don't like it - Font-Selection: You need to give the name of the font file. - Drawing on an image needs a different object that pasting and saving. - The handbook is from Dec. 2006. I don't want to dissapoint you but PIL font handling sucks terribly. I have repeatedly seen the attitude in your last point, and I simply do not understand it. What on Earth is wrong with having a product that actually becomes stable? We all complain about Microsoft's feature bloat, rolling out unnecessary new releases of their products year after year with features that no one really needs. But when an open source product FAILS to produce a new release every six weeks, we start seeing posts questioning whether the product is still viable or has become abandonware. I think if you really TRY to create your own project you'll understand what's going on here. From near 10 open source projects that I've started only 1 is living today. Once a product does the job it was designed to do, IT'S DONE. Because there's no such thing as do the job you where designed to do Example: designed for image manipulation. No matter how many features you've already implemented there's always something more to do. Personally, I think PIL is a great solution for batch processing, but the beauty of the open source world is that the ARE alternatives. Yes, it's open source, and everybody will win if you'll extend PIL to do what you want. Really, I do have some working snippets of code that do handle fonts nicely with PIL images, read and parse OpenType tables, but I can't publish it because it's optimized for my private needs like only two languages: Russian and English. I had to rewrite PIL's FreeType layer from scratch to do what I want. You can do the same. Ivan -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Processing (batch)
Thomas Guettler [EMAIL PROTECTED] wrote: I tried PIL for image batch processing. But somehow I don't like it - Font-Selection: You need to give the name of the font file. - Drawing on an image needs a different object that pasting and saving. - The handbook is from Dec. 2006. I have repeatedly seen the attitude in your last point, and I simply do not understand it. What on Earth is wrong with having a product that actually becomes stable? We all complain about Microsoft's feature bloat, rolling out unnecessary new releases of their products year after year with features that no one really needs. But when an open source product FAILS to produce a new release every six weeks, we start seeing posts questioning whether the product is still viable or has become abandonware. Once a product does the job it was designed to do, IT'S DONE. Personally, I think PIL is a great solution for batch processing, but the beauty of the open source world is that the ARE alternatives. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Processing (batch)
Tim Roberts wrote: Thomas Guettler [EMAIL PROTECTED] wrote: I tried PIL for image batch processing. But somehow I don't like it - Font-Selection: You need to give the name of the font file. - Drawing on an image needs a different object that pasting and saving. - The handbook is from Dec. 2006. I have repeatedly seen the attitude in your last point, and I simply do not understand it. What on Earth is wrong with having a product that actually becomes stable? Nothing, and it is correct pointing that out. OTOH, there are billions of open source projects out there that started with an idea but never entered that finished state where they are useful, so-called abandonware. If the documentation is old, it is either stable or abandoned. Only a closer look can tell which of both, but statistically it is more likely that it is abandoned, sad as it is. Peace! Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Processing (batch)
Weinhandl Herbert schrieb: Thomas Guettler schrieb: Hi, I tried PIL for image batch processing. But somehow I don't like it - Font-Selection: You need to give the name of the font file. - Drawing on an image needs a different object that pasting and saving. - The handbook is from Dec. 2006. What image libraries do you suggest? try : http://photobatch.stani.be/ This is a GUI, my processing needs to be done on the server. I need a library with Python API. photobatch uses PIL, so I think I would not gain much. Does photobatch improve font loading? BTW, the homepage of this project uses frames. The URL does not change, ... you can't send links or bookmark pages. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Processing (batch)
Thomas Guettler schrieb: Hi, I tried PIL for image batch processing. But somehow I don't like it - Font-Selection: You need to give the name of the font file. - Drawing on an image needs a different object that pasting and saving. - The handbook is from Dec. 2006. What image libraries do you suggest? try : http://photobatch.stani.be/ hth Herbert -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Processing (batch)
Thomas Guettler wrote: I tried PIL for image batch processing. But somehow I don't like it - Font-Selection: You need to give the name of the font file. - Drawing on an image needs a different object that pasting and saving. - The handbook is from Dec. 2006. What image libraries do you suggest? I haven't looked at it yet, but I was thrilled to hear that GIMP (www.gimp.org) had the ability to be extended via Python scripts. Maybe that would help? Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
On Sun, May 4, 2008 at 4:25 PM, Valerio Valerio [EMAIL PROTECTED] wrote: Hi, anyone know a Python library to grab the size of a selected image region (the selection will be made with the mouse), that work in Linux ? You might be able to use this tool: http://freshmeat.net/projects/gtkshots/ David. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
I can grab the image, I need a way of grab the region size with the mouse, a easy way of the user select a region of the image to analyze, something like the Rectangle selection tool of gimp. Regards, -- Valério Valério http://www.valeriovalerio.org 2008/5/4 David [EMAIL PROTECTED]: On Sun, May 4, 2008 at 4:25 PM, Valerio Valerio [EMAIL PROTECTED] wrote: Hi, anyone know a Python library to grab the size of a selected image region (the selection will be made with the mouse), that work in Linux ? You might be able to use this tool: http://freshmeat.net/projects/gtkshots/ David. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio [EMAIL PROTECTED] wrote: I can grab the image, I need a way of grab the region size with the mouse, a easy way of the user select a region of the image to analyze, something like the Rectangle selection tool of gimp. I assume what you want to do is allow the user to drag the mouse across your desktop, and your program, running in the background, picks this up? As opposed to the user making a rectangular selection entirely within your app. I think the simplest way to do this is to capture the entire screen, then show it as an image on a window covering the entire screen (eg: fullscreen mode, or a regular window without decorations). Then listen for mouse events. There should be a way to show the 'rectangle elastic band' at the same time. Otherwise just draw a rectangle between where the user first clicked and where the mouse is now (until they release the mouse button). Another way would be to listen to all events sent through X, and act based on the mouse events. VNC does something similar. A good starting point would be the Python xlib libraries: http://python-xlib.sourceforge.net/ David. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
Another way would be to listen to all events sent through X, and act based on the mouse events. VNC does something similar. See the 'record_demo.py' example that comes with python-xlib. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
Hi, 2008/5/4 David [EMAIL PROTECTED]: On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio [EMAIL PROTECTED] wrote: I can grab the image, I need a way of grab the region size with the mouse, a easy way of the user select a region of the image to analyze, something like the Rectangle selection tool of gimp. I assume what you want to do is allow the user to drag the mouse across your desktop, and your program, running in the background, picks this up? As opposed to the user making a rectangular selection entirely within your app. What I want is display a window with a image, the user select a region of the image, and the region value is passed to my program, my program slice the image region, and analyze it. I think the Xlib libraries can help in my task, thanks for the help :) Cheers, -- Valério Valério http://www.valeriovalerio.org I think the simplest way to do this is to capture the entire screen, then show it as an image on a window covering the entire screen (eg: fullscreen mode, or a regular window without decorations). Then listen for mouse events. There should be a way to show the 'rectangle elastic band' at the same time. Otherwise just draw a rectangle between where the user first clicked and where the mouse is now (until they release the mouse button). Another way would be to listen to all events sent through X, and act based on the mouse events. VNC does something similar. A good starting point would be the Python xlib libraries: http://python-xlib.sourceforge.net/ David. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
What I want is display a window with a image, the user select a region of the image, and the region value is passed to my program, my program slice the image region, and analyze it. If it's your apps own window, then getting a rectangle selected by the user is simple. 1) Make skeleton x/gtk/wx/qt/etc app 2) Add code to show an image 3) Add code to capture mouse events 4) Add code to show the 'rubber band' rectangle over the mouse selection area 5) When the user releases the mouse, then extract the part of the rectangle between where a mouse button was clicked and where it was released. All this would be in the docs for the Python x/gtk/wx/qt/etc libs. Where is the difficulty? David. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image grab in Python
2008/5/4 David [EMAIL PROTECTED]: What I want is display a window with a image, the user select a region of the image, and the region value is passed to my program, my program slice the image region, and analyze it. If it's your apps own window, then getting a rectangle selected by the user is simple. 1) Make skeleton x/gtk/wx/qt/etc app 2) Add code to show an image 3) Add code to capture mouse events 4) Add code to show the 'rubber band' rectangle over the mouse selection area 5) When the user releases the mouse, then extract the part of the rectangle between where a mouse button was clicked and where it was released. All this would be in the docs for the Python x/gtk/wx/qt/etc libs. Where is the difficulty? Right now I don't have any difficulty :) I just asked for a library to do that, if exist I don't have to write all the things from scratch (the selection part), but I am able to do my tasks easily with Xlib or Pygame. Thanks for the help. Cheers, -- Valério Valério http://www.valeriovalerio.org David. -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
On Mar 14, 10:59 am, Daniel Fetchinson [EMAIL PROTECTED] wrote: Since you seem to know quite a bit about this topic, what is your opinion on the apparently 'generic' algorithm described here: http://grail.cs.washington.edu/projects/query/? So far it seems to me that it does what I'm asking for, it does even more because it can take a hand drawn sample image and query the database for similar photos. There is even a python implementation for it here: http://members.tripod.com/~edcjones/pycode.html On the histogram method I agree that it won't work partly because of what you say and partly because it is terribly slow since it's comparing every single pixel. I'm hardly the expert and can't answer authoritatively, but here's my 2c. I can't comment as to the actual accuracy of the algorithm, since it will depend on your specific data set (set of photos). The algorithm is sensitive to spatial and luminance information (because of the YIQ colorspace), so there are simple ways in which it will fail. The histogram method uses only color, but has a lot of numbers to compare. You may find the histogram method insensitive to spatial relations (a landscape with the mountain on the left and one with the mountain on the right) compared to the wavelet approach. This is a relatively old paper, and I've seen other more recent image retrieval research using wavelets (some cases using only the high-frequency wavelets for texture information instead of the low-frequency ones used by this paper for shape) and other information retrieval-related research using lossy compressed data as the features. If you have time, you may want to look at other research that cite this particular paper. And just a thought: Instead of merely cutting off at m largest-wavelets, why not apply a quantization matrix to all the values? I'm not at all an expert, just started to look into image matching, so I'm not quite sure what you mean. What's a quantization matrix in this context? Hello, I am also looking for the solution to the same problem. Could you let me know if you have found something useful so far? I appreciate your response. Thanks a lot. Sengly -- http://mail.python.org/mailman/listinfo/python-list
Re: Image handling - stupid question
Jumping Arne a écrit : I'm going to try to write some imange manipulation code (scaling, reading EXIF and IPTC info) and just want to ask if PIL is *THE* library to use? I looked at http://www.pythonware.com/products/pil/ and noticed that the latest version is from Dec 2006. In my experience that means that either it's abandoned I doubt it is. or that it's very good and stable. My own experience is that it's indeed a pretty good and AFAICT stable library. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image handling - stupid question
Jumping Arne wrote: I'm going to try to write some imange manipulation code (scaling, reading EXIF and IPTC info) and just want to ask if PIL is *THE* library to use? I looked at http://www.pythonware.com/products/pil/ and noticed that the latest version is from Dec 2006. In my experience that means that either it's abandoned or that it's very good and stable. Certainly the latter. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Image handling - stupid question
On Apr 16, 12:21 pm, Jumping Arne [EMAIL PROTECTED] wrote: I'm going to try to write some imange manipulation code (scaling, reading EXIF and IPTC info) and just want to ask if PIL is *THE* library to use? Depends on your requirements, but it's certainly the first library I would check out. It offers lots of functionality, it is easy to use, well documented and rock solid. I looked at http://www.pythonware.com/products/pil/ and noticed that the latest version is from Dec 2006. In my experience that means that either it's abandoned or that it's very good and stable. The latter (what else would you expect from /F? :) 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: Image handling - stupid question
On Wed, 16 Apr 2008 12:21:13 +0200, Jumping Arne wrote (in article [EMAIL PROTECTED]): I'm going to try to write some imange manipulation code (scaling, reading EXIF and IPTC info) and just want to ask if PIL is *THE* library to use? I looked at http://www.pythonware.com/products/pil/ and noticed that the latest version is from Dec 2006. In my experience that means that either it's abandoned or that it's very good and stable. Sounds like PIL is a safe option, thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image handling - stupid question
Jumping Arne wrote: On Wed, 16 Apr 2008 12:21:13 +0200, Jumping Arne wrote (in article [EMAIL PROTECTED]): I'm going to try to write some imange manipulation code (scaling, reading EXIF and IPTC info) and just want to ask if PIL is *THE* library to use? I looked at http://www.pythonware.com/products/pil/ and noticed that the latest version is from Dec 2006. In my experience that means that either it's abandoned or that it's very good and stable. Sounds like PIL is a safe option, thanks. Yes, certainly, PIL is the way to go. But beyond that, if you are going to do any fancy manipulation of the array of pixels (e.g., image processing, image recognition, convolution, ...), then I'd recommend numpy for the array manipulation. (And perhaps even the full-blown scipy.) Numpy can easily access and manipulate the pixel arrays produced by PIL. It's an awesome combination. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Daniel Fetchinson wrote: Since you seem to know quite a bit about this topic, what is your opinion on the apparently 'generic' algorithm described here: http://grail.cs.washington.edu/projects/query/ ? So far it seems to me that it does what I'm asking for, it does even more because it can take a hand drawn sample image and query the database for similar photos. There is even a python implementation for it here: http://members.tripod.com/~edcjones/pycode.html On the histogram method I agree that it won't work partly because of what you say and partly because it is terribly slow since it's comparing every single pixel. I'm hardly the expert and can't answer authoritatively, but here's my 2c. I can't comment as to the actual accuracy of the algorithm, since it will depend on your specific data set (set of photos). The algorithm is sensitive to spatial and luminance information (because of the YIQ colorspace), so there are simple ways in which it will fail. The histogram method uses only color, but has a lot of numbers to compare. You may find the histogram method insensitive to spatial relations (a landscape with the mountain on the left and one with the mountain on the right) compared to the wavelet approach. This is a relatively old paper, and I've seen other more recent image retrieval research using wavelets (some cases using only the high-frequency wavelets for texture information instead of the low-frequency ones used by this paper for shape) and other information retrieval-related research using lossy compressed data as the features. If you have time, you may want to look at other research that cite this particular paper. And just a thought: Instead of merely cutting off at m largest-wavelets, why not apply a quantization matrix to all the values? Let me know how it works out. -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Since you seem to know quite a bit about this topic, what is your opinion on the apparently 'generic' algorithm described here: http://grail.cs.washington.edu/projects/query/ ? So far it seems to me that it does what I'm asking for, it does even more because it can take a hand drawn sample image and query the database for similar photos. There is even a python implementation for it here: http://members.tripod.com/~edcjones/pycode.html On the histogram method I agree that it won't work partly because of what you say and partly because it is terribly slow since it's comparing every single pixel. I'm hardly the expert and can't answer authoritatively, but here's my 2c. I can't comment as to the actual accuracy of the algorithm, since it will depend on your specific data set (set of photos). The algorithm is sensitive to spatial and luminance information (because of the YIQ colorspace), so there are simple ways in which it will fail. The histogram method uses only color, but has a lot of numbers to compare. You may find the histogram method insensitive to spatial relations (a landscape with the mountain on the left and one with the mountain on the right) compared to the wavelet approach. This is a relatively old paper, and I've seen other more recent image retrieval research using wavelets (some cases using only the high-frequency wavelets for texture information instead of the low-frequency ones used by this paper for shape) and other information retrieval-related research using lossy compressed data as the features. If you have time, you may want to look at other research that cite this particular paper. And just a thought: Instead of merely cutting off at m largest-wavelets, why not apply a quantization matrix to all the values? I'm not at all an expert, just started to look into image matching, so I'm not quite sure what you mean. What's a quantization matrix in this context? -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Thanks for the info! SIFT really looks like a heavy weight solution, but do you think the whole concept can be simplified if all I needed was: given a photo, find similar ones? I mean SIFT first detects objects on the image and find similarities, but I don't need the detection part at all, all I care about is similarity for the whole photo. I surely don't understand the big picture fully but just have the general feeling that SIFT and other expert tools are an overkill for me and a simplified version would be just as good with a much more easily comprehensible core algorithm. Please describe the kind of photos you are dealing with. Are they identical photos, in say different formats or with different metadata? Or are they rescaled images? Or maybe they are the same photo cropped differently? The photos are just coming straight from my digital camera. Same format (JPEG), varying size (6-10 megapixel) and I would like to be able to pick one and then query the database for similar ones. For example: I pick a photo which is more or less a portrait of someone, the query should return other photos with more or less portraits. If I pick a landscape with lot of green and a mountain the query should result in other nature (mostly green) photos. Something along these lines, of course the matches won't be perfect because I'm looking for a simple algorithm, but something along these lines. SIFT will work in more or less the process you described in your first post. It basically calculates the N sets of numbers for each image, representing the unique features of that image and their relative positions. The rest of the process if up to you. You have to compare the different sets of numbers to find the image with the minimal difference, as opposed to comparing the whole image. Great, this sounds very good, I'll give SIFT a try (at least trying to understand the basic concepts) although at the moment it looks a bit scary :) -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Daniel Fetchinson wrote: The photos are just coming straight from my digital camera. Same format (JPEG), varying size (6-10 megapixel) and I would like to be able to pick one and then query the database for similar ones. For example: I pick a photo which is more or less a portrait of someone, the query should return other photos with more or less portraits. If I pick a landscape with lot of green and a mountain the query should result in other nature (mostly green) photos. Something along these lines, of course the matches won't be perfect because I'm looking for a simple algorithm, but something along these lines. Ah. In that case, SIFT isn't for you. SIFT would work well if you have multiple photos of the same object. Say, a building from different angles, or the a vase against different backdrops. If I'm understanding your correctly, what you're attempting here is very general and well into the highly experimental. I've been wishing for such a feature to appear in something like Google Image Search (pick/submit a photo and return similar images found on the web). I'm sure if there's even a practical solution, Google (or MS) would be on it already. The problem is that there isn't really one. Despite what you may see claimed in university press releases and research papers, the current crop of algorithms don't work very well, at least according to my understanding and discussion with researchers in this field. The glowing results tend to be from tests done under ideal conditions and there's no real practical and commercial solution. If you restrict the domain somewhat, there are some solutions, but none trivial. You are probably aware of the face searches available on Google and Live. The histogram approach suggested by Shane Geiger may work for some cases and in fact would work very well for identical resized images. I doubt it will work for the general case. A mountain with a grassy plain at noon has quite a different histogram from one at sunset, and yet both have related content. Manual tagging of the images, a la Flickr, would probably be your best bet. Good luck. -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
The photos are just coming straight from my digital camera. Same format (JPEG), varying size (6-10 megapixel) and I would like to be able to pick one and then query the database for similar ones. For example: I pick a photo which is more or less a portrait of someone, the query should return other photos with more or less portraits. If I pick a landscape with lot of green and a mountain the query should result in other nature (mostly green) photos. Something along these lines, of course the matches won't be perfect because I'm looking for a simple algorithm, but something along these lines. Ah. In that case, SIFT isn't for you. SIFT would work well if you have multiple photos of the same object. Say, a building from different angles, or the a vase against different backdrops. If I'm understanding your correctly, what you're attempting here is very general and well into the highly experimental. I've been wishing for such a feature to appear in something like Google Image Search (pick/submit a photo and return similar images found on the web). I'm sure if there's even a practical solution, Google (or MS) would be on it already. The problem is that there isn't really one. Despite what you may see claimed in university press releases and research papers, the current crop of algorithms don't work very well, at least according to my understanding and discussion with researchers in this field. The glowing results tend to be from tests done under ideal conditions and there's no real practical and commercial solution. If you restrict the domain somewhat, there are some solutions, but none trivial. You are probably aware of the face searches available on Google and Live. The histogram approach suggested by Shane Geiger may work for some cases and in fact would work very well for identical resized images. I doubt it will work for the general case. A mountain with a grassy plain at noon has quite a different histogram from one at sunset, and yet both have related content. Manual tagging of the images, a la Flickr, would probably be your best bet. Since you seem to know quite a bit about this topic, what is your opinion on the apparently 'generic' algorithm described here: http://grail.cs.washington.edu/projects/query/ ? So far it seems to me that it does what I'm asking for, it does even more because it can take a hand drawn sample image and query the database for similar photos. There is even a python implementation for it here: http://members.tripod.com/~edcjones/pycode.html On the histogram method I agree that it won't work partly because of what you say and partly because it is terribly slow since it's comparing every single pixel. Thanks, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
| The various free tools differ by their chosen optimization paths and | their degree of specialization. My preference would be, | | 1. Doesn't really matter how long it takes to compute the N numbers per image Your problem here is that there is really no such thing as 'general features' and correspondingly, no such thing as 'general similarity of features'. Yes there are! :) Image manipulation experts defined dozens of ways of characterizing what 'similarity' means for images and all I was asking is whether anyone here knew of a simple one. The features extracted have to have a specific definition. The features represent a severe lossy compression of the original. What to keep depends on the application. Yes, and if you know *any* simple but useful (yes, useful, in *any* sense) definition, I'd be happy to hear it. Example: classify each pixel as white, black, red, green, or blue. Will that match your intuitive idea of what matches? Probably not, but thanks for the idea. To be a bit more sophisticated, use more color bins and do the binning separately for multiple areas, such as top, left, center, right, and bottom (or center, upper right, upper left, lower right, and lower left). I suspect Google does something like this to match, for instance, pictures with skin tones in the center, or pictures with blue tops (sky?) and green bottoms (vegetation?). Now this sounds like a simple and good idea. I'll try this and see how far I get. | 2. Lookups should be fast, consequently N should not be too large (I guess) | 3. It should be a generic algorithm working on generic images (everyday photos) Given feature vectors, there are various ways to calculate a distance or similarity coefficient. There have been great debates on what is 'best'. True. As I've said, *any* but concrete and useful example would make me happy. | 4. PIL should be enough for the implementation | | So if anyone knows of a good resource that is close to being pseudo | code I would be very grateful! If you do not have sufficient insight into your own idea of 'matches', try something on a test set of perhaps 20 photos, calculate a 'match matrix', and compare that you your intuition. Yes, this is what I'll do. The second thing I'll try (after trying your suggestion) is based on this paper which I found in the meantime: http://salesin.cs.washington.edu/abstracts.html#MultiresQuery In case anyone is interested, it describes a multiresolution querying algorithm and best of all, it has pseudo code for the various steps. I don't know yet how difficult the implementation will be but so far this looks the most promising. Cheers, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
The second thing I'll try (after trying your suggestion) is based on this paper which I found in the meantime: http://salesin.cs.washington.edu/abstracts.html#MultiresQuery In case anyone is interested, it describes a multiresolution querying algorithm and best of all, it has pseudo code for the various steps. I don't know yet how difficult the implementation will be but so far this looks the most promising. Actually, the exact same algorithm has already been implemented in ... drum roll python! http://members.tripod.com/~edcjones/pycode.html -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
On Mar 10, 1:32 am, Daniel Fetchinson [EMAIL PROTECTED] wrote: Hi all, There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of a research paper (from which I also found a lot but since I'm not that much interested in the actual science of image recognition this seems like an over kill). My understanding of image matching is that it works by first calculating N real numbers for an image and defining a metric for pairs of N-tuples. Images are similar if their distance (defined by the metric) is small. The various free tools differ by their chosen optimization paths and their degree of specialization. My preference would be, 1. Doesn't really matter how long it takes to compute the N numbers per image 2. Lookups should be fast, consequently N should not be too large (I guess) 3. It should be a generic algorithm working on generic images (everyday photos) 4. PIL should be enough for the implementation http://www.idi.ntnu.no/~blake/gbimpdet.htm High level features carry information about an image in an abstracted or propositional form It says it constructs a graph about the image's features. Here's the graph: Graph componentsNotes [EMAIL PROTECTED];ext:sqr:aa(1659):mm(19815,148,0,0):- Leading node cg(62,86):cr(255,153,153):pl(-204,574,792,10353)]]with attributes [EMAIL PROTECTED] 1 ]] - Relation and strength [EMAIL PROTECTED];ext:sqr:aa(199):mm(17759,244,1,0): - Trailing node cg(98,77):cr(153,153,255):pl(966,2,258,-79198)]]$ with attributes It doesn't say what corner cases it leaves. seem to provide and seems to be extremely flexible. I like this feature: - the equation of the best fitting plane Ax+By+Cz+D=0 to the range image data masked by the current region; Where does that get you? -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Daniel Fetchinson wrote: There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of a research paper (from which I also found a lot but since I'm not that much interested in the actual science of image recognition this seems like an over kill). I'd recommend SIFT. There's quite a bit of information on SIFT. In most cases, they don't cover the background science too much, but are still heavy on the math. Pseudo code is hard to come by since it will take many lines of pseudo code just to express one concise mathematical equation. There are however many links to implementations in various languages on the Wikipedia page. http://en.wikipedia.org/wiki/Scale-invariant_feature_transform I have had good experiences with SIFT for feature extraction from images (I have used it for panorama stitching and robot mapping). It's insensitive to scale and rotation. Note that it is a patented algorithm and this may (or may not) pose a problem for you. -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of a research paper (from which I also found a lot but since I'm not that much interested in the actual science of image recognition this seems like an over kill). I'd recommend SIFT. There's quite a bit of information on SIFT. In most cases, they don't cover the background science too much, but are still heavy on the math. Pseudo code is hard to come by since it will take many lines of pseudo code just to express one concise mathematical equation. There are however many links to implementations in various languages on the Wikipedia page. http://en.wikipedia.org/wiki/Scale-invariant_feature_transform I have had good experiences with SIFT for feature extraction from images (I have used it for panorama stitching and robot mapping). It's insensitive to scale and rotation. Note that it is a patented algorithm and this may (or may not) pose a problem for you. Thanks for the info! SIFT really looks like a heavy weight solution, but do you think the whole concept can be simplified if all I needed was: given a photo, find similar ones? I mean SIFT first detects objects on the image and find similarities, but I don't need the detection part at all, all I care about is similarity for the whole photo. I surely don't understand the big picture fully but just have the general feeling that SIFT and other expert tools are an overkill for me and a simplified version would be just as good with a much more easily comprehensible core algorithm. Or am I being too optimistic and there is no way out of going into the details? -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Daniel Fetchinson wrote: Thanks for the info! SIFT really looks like a heavy weight solution, but do you think the whole concept can be simplified if all I needed was: given a photo, find similar ones? I mean SIFT first detects objects on the image and find similarities, but I don't need the detection part at all, all I care about is similarity for the whole photo. I surely don't understand the big picture fully but just have the general feeling that SIFT and other expert tools are an overkill for me and a simplified version would be just as good with a much more easily comprehensible core algorithm. Please describe the kind of photos you are dealing with. Are they identical photos, in say different formats or with different metadata? Or are they rescaled images? Or maybe they are the same photo cropped differently? SIFT will work in more or less the process you described in your first post. It basically calculates the N sets of numbers for each image, representing the unique features of that image and their relative positions. The rest of the process if up to you. You have to compare the different sets of numbers to find the image with the minimal difference, as opposed to comparing the whole image. -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Daniel Fetchinson wrote: There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of a research paper (from which I also found a lot but since I'm not that much interested in the actual science of image recognition this seems like an over kill). I'd recommend SIFT. There's quite a bit of information on SIFT. In most cases, they don't cover the background science too much, but are still heavy on the math. Pseudo code is hard to come by since it will take many lines of pseudo code just to express one concise mathematical equation. There are however many links to implementations in various languages on the Wikipedia page. http://en.wikipedia.org/wiki/Scale-invariant_feature_transform I have had good experiences with SIFT for feature extraction from images (I have used it for panorama stitching and robot mapping). It's insensitive to scale and rotation. Note that it is a patented algorithm and this may (or may not) pose a problem for you. Thanks for the info! SIFT really looks like a heavy weight solution, but do you think the whole concept can be simplified if all I needed was: given a photo, find similar ones? I mean SIFT first detects objects on the image and find similarities, but I don't need the detection part at all, all I care about is similarity for the whole photo. I surely don't understand the big picture fully but just have the general feeling that SIFT and other expert tools are an overkill for me and a simplified version would be just as good with a much more easily comprehensible core algorithm. Or am I being too optimistic and there is no way out of going into the details? Using the histogram of the picture may be good enough for your application. Here's something I put together for comparing images (for purposes of detecting motion) taken by the built-in web cam in my Macbook Pro. This might be good enough if you play with the threshold. I'm writing a simple little app for doing motion detection with data output from wacaw, a package for MacOSX. You could easily modify this script to get data output from some other source. cd /Applications ; for i in `jot 1024`; do /Applications/wacaw --png picture-${i} sleep 3 ; done; open *.png cd /Applications; open picture-* # cd /Applications ; for i in `jot 1024`; do /Applications/wacaw --png picture-${i} sleep 3 ; done; open *.png # SOURCE: http://gumuz.looze.net/wordpress/index.php/archives/2005/06/06/python-webcam-fun-motion-detection/ import os from time import sleep import tempfile import Image # Sun Mar 18 16:40:51 CDT 2007 def diff_image(img1, img2, pix_threshold=50, img_threshold=4): Compare 2 images to detect possible motion You might want to choose the img_threshold amount based on the conditions. img1 = Image.open(img1) img2 = Image.open(img2) if not img1 or not img2: return False img1 = img1.getdata() img2 = img2.getdata() pixel_count = len(img1) pixdiff = 0 for i in range(pixel_count): #if abs(sum(img1[i]) - sum(img2[i])) pix_threshold: diffval = abs(sum(img1[i]) - sum(img2[i])) #print Pixel diffval:,diffval if diffval pix_threshold: pixdiff += 1 diffperc = pixdiff / (pixel_count/100.0) print Photo diff percentage:,diffperc if diffperc img_threshold: # motion detected return True else: return False photos = [] # consider automatically serializing this data import commands def analyze_thresholds(list_of_photos): last = list_of_photos[0] for photo in list_of_photos[1:]: diff_image(last, photo) last = photo def detect(): number = 0 while True: number += 1 sleep(3) current = 'photo-'+str(number) #tmp = tempfile.mktemp() print commands.getoutput('/Applications/wacaw --png ' + current ) # ' + tmp +'.png') # Here's the actual name of the file wacaw created: current = '/Applications/'+current+'.png' photos.append( current ) if len(photos) 2: # pad the list for the first time photos.append( current ) if diff_image(photos[-1],photos[-2], pix_threshold=50, img_threshold=5): print motion detected else: print motion NOT detected detect() #import glob #analyze_thresholds(glob.glob('/Applications/photo-*') -- Shane Geiger IT Director National Council on Economic Education [EMAIL PROTECTED] | 402-438-8958 | http://www.ncee.net Leading the Campaign for Economic and Financial Literacy -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
There are a number of free tools for image matching but it's not very easy to decipher the actual algorithm from the code that includes db management, GUI, etc, etc. I have my own image database and GUI so all I need is the actual algorithm preferably in pseudo code and not in the form of a research paper (from which I also found a lot but since I'm not that much interested in the actual science of image recognition this seems like an over kill). I'd recommend SIFT. There's quite a bit of information on SIFT. In most cases, they don't cover the background science too much, but are still heavy on the math. Pseudo code is hard to come by since it will take many lines of pseudo code just to express one concise mathematical equation. There are however many links to implementations in various languages on the Wikipedia page. http://en.wikipedia.org/wiki/Scale-invariant_feature_transform I have had good experiences with SIFT for feature extraction from images (I have used it for panorama stitching and robot mapping). It's insensitive to scale and rotation. Note that it is a patented algorithm and this may (or may not) pose a problem for you. Thanks for the info! SIFT really looks like a heavy weight solution, but do you think the whole concept can be simplified if all I needed was: given a photo, find similar ones? I mean SIFT first detects objects on the image and find similarities, but I don't need the detection part at all, all I care about is similarity for the whole photo. I surely don't understand the big picture fully but just have the general feeling that SIFT and other expert tools are an overkill for me and a simplified version would be just as good with a much more easily comprehensible core algorithm. Or am I being too optimistic and there is no way out of going into the details? Using the histogram of the picture may be good enough for your application. Here's something I put together for comparing images (for purposes of detecting motion) taken by the built-in web cam in my Macbook Pro. This might be good enough if you play with the threshold. I'm writing a simple little app for doing motion detection with data output from wacaw, a package for MacOSX. You could easily modify this script to get data output from some other source. Thanks Shane, this is simple enough indeed, which is great. I'll give this a try and maybe it'll be good enough for me. -- http://mail.python.org/mailman/listinfo/python-list
Re: image matching algorithms
Daniel Fetchinson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | The various free tools differ by their chosen optimization paths and | their degree of specialization. My preference would be, | | 1. Doesn't really matter how long it takes to compute the N numbers per image Your problem here is that there is really no such thing as 'general features' and correspondingly, no such thing as 'general similarity of features'. The features extracted have to have a specific definition. The features represent a severe lossy compression of the original. What to keep depends on the application. Example: classify each pixel as white, black, red, green, or blue. Will that match your intuitive idea of what matches? To be a bit more sophisticated, use more color bins and do the binning separately for multiple areas, such as top, left, center, right, and bottom (or center, upper right, upper left, lower right, and lower left). I suspect Google does something like this to match, for instance, pictures with skin tones in the center, or pictures with blue tops (sky?) and green bottoms (vegetation?). | 2. Lookups should be fast, consequently N should not be too large (I guess) | 3. It should be a generic algorithm working on generic images (everyday photos) Given feature vectors, there are various ways to calculate a distance or similarity coefficient. There have been great debates on what is 'best'. | 4. PIL should be enough for the implementation | | So if anyone knows of a good resource that is close to being pseudo | code I would be very grateful! If you do not have sufficient insight into your own idea of 'matches', try something on a test set of perhaps 20 photos, calculate a 'match matrix', and compare that you your intuition. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Libraries
PB wrote: I have been using PIL for generating images, however it does not easily support operations with transparency etc. I tried to install aggdraw but it wouldn't compile. Ideally I'd like something open source so I can adapt it, hopefully mostly written in python rather than C. Is there any other decent image libraries for python? I use PIL, and I haven't had any difficulty with alpha channel transparency. But maybe I'm using it for different things than you (blitting PGN(RGBA) antialiased images mostly). What problems are you having specifically? Ken Seehart -- http://mail.python.org/mailman/listinfo/python-list
Re: Image Libraries
Maybe I am unaware of the right way to do it, but the only way I can think to draw several shapes of different transparencies is to create an image for each layer and then combine them which seems overly complex. It would be nice to simply be able to specify colors with an alpha value combined (ie RGBA) for image draw operations. Is there a way to do this? Cheers, Peter Ken wrote: PB wrote: I have been using PIL for generating images, however it does not easily support operations with transparency etc. I tried to install aggdraw but it wouldn't compile. Ideally I'd like something open source so I can adapt it, hopefully mostly written in python rather than C. Is there any other decent image libraries for python? I use PIL, and I haven't had any difficulty with alpha channel transparency. But maybe I'm using it for different things than you (blitting PGN(RGBA) antialiased images mostly). What problems are you having specifically? Ken Seehart -- http://mail.python.org/mailman/listinfo/python-list
Re: Image to browser
On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: Hi, noob here Im using mod_python and apache2 using psp for output of page, i open a file and resize it with the following code % import Image, util fields = util.FieldStorage(req) filename = fields.getlist('src')[0] path = '/var/www/content/' + filename size = 128, 128 im = Image.open(path) print im.resize(size, Image.ANTIALIAS) % so for one, I dont think print does much with psp as far as i can tell, i cant even do a print 'hello world', it has to be a req.write('hello world'), but i cant req.write the im.resize. The manual for im.resize states that its return can go ahead and be streamed via http but I get a blank page when im expecting to see image characters dumped to my screen. Python doesn't throw up any errors. Im not sure where else to look or what to do. Thanks for any help, Daniel its worth noting that ive tried using print Content-Type: image/jpeg\n before the print im.resize and still no luck -- http://mail.python.org/mailman/listinfo/python-list
Re: Image to browser
On Jan 16, 1:19 pm, [EMAIL PROTECTED] wrote: On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: Im using mod_python and apache2 using psp for output of page, i open a file and resize it with the following code % import Image, util fields = util.FieldStorage(req) filename = fields.getlist('src')[0] path = '/var/www/content/' + filename size = 128, 128 im = Image.open(path) print im.resize(size, Image.ANTIALIAS) % so for one, I dont think print does much with psp as far as i can tell, i cant even do a print 'hello world', it has to be a req.write('hello world'), but i cant req.write the im.resize. The manual for im.resize states that its return can go ahead and be streamed via http but I get a blank page when im expecting to see image characters dumped to my screen. Python doesn't throw up any errors. Im not sure where else to look or what to do. Thanks for any help, Daniel its worth noting that ive tried using print Content-Type: image/jpeg\n before the print im.resize and still no luck If you're using the Image module from PIL then im.resize(...) returns an Image instance. I have not used mod_python and psp, but try the following: import Image i = Image.open('server.JPG') r = i.resize((32,32)) from StringIO import StringIO b = StringIO() r.save(b, 'JPEG') b.seek(0) req.write(Content-Type: image/jpeg\r\n\r\n) req.write(b.read()) There's a r.tostring(...) method but I don't see how to make that return a JPEG stream. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image to browser
On Jan 16, 12:38 am, Justin Ezequiel [EMAIL PROTECTED] wrote: On Jan 16, 1:19 pm, [EMAIL PROTECTED] wrote: On Jan 16, 12:16 am, [EMAIL PROTECTED] wrote: Im using mod_python and apache2 using psp for output of page, i open a file and resize it with the following code % import Image, util fields = util.FieldStorage(req) filename = fields.getlist('src')[0] path = '/var/www/content/' + filename size = 128, 128 im = Image.open(path) print im.resize(size, Image.ANTIALIAS) % so for one, I dont think print does much with psp as far as i can tell, i cant even do a print 'hello world', it has to be a req.write('hello world'), but i cant req.write the im.resize. The manual for im.resize states that its return can go ahead and be streamed via http but I get a blank page when im expecting to see image characters dumped to my screen. Python doesn't throw up any errors. Im not sure where else to look or what to do. Thanks for any help, Daniel its worth noting that ive tried using print Content-Type: image/jpeg\n before the print im.resize and still no luck If you're using the Image module from PIL then im.resize(...) returns an Image instance. I have not used mod_python and psp, but try the following: import Image i = Image.open('server.JPG') r = i.resize((32,32)) from StringIO import StringIO b = StringIO() r.save(b, 'JPEG') b.seek(0) req.write(Content-Type: image/jpeg\r\n\r\n) req.write(b.read()) There's a r.tostring(...) method but I don't see how to make that return a JPEG stream. brilliant, at least to me anyway, it works as long as i remove the req.write(content-type... now i have a lot to look up, i tried something similar to this before that i found on the web but no luck. i guess whats going on is it gets saved to this pseudo file thats just a string existing in memory, and then the pointer gets set to the begining of the string for the upcoming read() ? i dunno, but something else to learn about. I must admit i was hoping for something a little more elegant. Thanks for your help! -- http://mail.python.org/mailman/listinfo/python-list
Re: Image/Video Processing in Python
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I'm trying to work on a project in Python that involves the use of a webcam to track a laser pointer. I found some example code here http://janto.blogspot.com/2006/01/motion-capture-in-python.html, but the problem is that it's quite slow (about a sec to process a 800 by 600 image). Can anyone who has experience with computer vision help me? Are there any existing algorithms for finding a color in an image and plotting its coordinates? It would help me very much. You're talking about raw number crunching. This is exactly the kind of case where you should write some C or C++ code and call it from Python. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list