469,343 Members | 5,420 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

Numpy and Image error

Hi,
I'm trying to equalize an histogram of a raster image. I'm trying to following the method found in this site:

http://www.janeriksolem.net/2009/06/...ython-and.html

So I did the following step:

Expand|Select|Wrap|Line Numbers
  1. from PIL import Image
  2. from numpy import *
  3.  
  4. im = array(Image.open('AquaTermi_lowcontrast.jpg').convert('L'))
  5. imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
  6. cdf = imhist.cumsum() 
  7. cdf = 255 * cdf / cdf[-1]
  8. im2 = interp(im.flatten(),bins[:-1],cdf)
  9. im2.reshape(im.shape)
  10. im2.save(filename)
But I get the following error:

Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'numpy.ndarray' object has no attribute 'save'

Do you know where I wrong?How can I fix it?
thx
Jul 13 '11 #1
1 5808
bvdet
2,851 Expert Mod 2GB
As the error message indicates, the array object im2 has no save method. If you are trying to create another image, you are going about it the wrong way.
Jul 13 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Winston | last post: by
9 posts views Thread by Karl Burrows | last post: by
6 posts views Thread by Patrick Dugan | last post: by
18 posts views Thread by robert | last post: by
8 posts views Thread by ctiggerf | last post: by
1 post views Thread by blackraven1425 | last post: by
pradeepjain
1 post views Thread by pradeepjain | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.