By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

Numpy and Image error

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

So I did the following step:

Expand|Select|Wrap|Line Numbers
  1. from PIL import Image
  2. from numpy import *
  4. im = array('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)
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?
Jul 13 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851
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.