473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 6713
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

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

Similar topics

0
by: Winston | last post by:
Hi, I am trying to display an image using BLOB in crystal reports. The Reports BLOLB fields are generated using an XML Schema as follows: .... <xs:element name="bSignature"> <xs:complexType>...
9
by: Karl Burrows | last post by:
I am working on a Website for a non-profit group and for some reason I have one link that doesn't want to cooperate. All the image links work fine with the onmouseover and onmouseout script except...
6
by: Patrick Dugan | last post by:
Hello, I'm trying to load different images (icons) into a PictureBox1.Image. The first image loads just fine, but the second image always returns the error "Invalid property used." It doesn't...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
18
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? ...
8
by: ctiggerf | last post by:
I was hopeing someone could help me out here. Been stumped on this one all day. This function 1. Checks uploaded files. 2. Creates two resized images from each (a full size, and a...
7
by: Struggler | last post by:
Please could somebody help me feel like less of a complete idiot. Following the advice of people who know what they're talking about, I have abandoned MS Front Page and MS Publisher and am trying to...
1
by: blackraven1425 | last post by:
On Eclipse, I've been getting this error that the method getScaledInstance is undefined for type String, but I'm not using Strings, rather 3 ints. Any idea on how to remove this error? Image pic2...
2
by: defn noob | last post by:
from Tkinter import * import os master = Tk() w = Canvas(master, width=800, height=600) print os.path.exists('C:/me/saftarn/desktop/images/blob4.jpg') im = PhotoImage(file =...
1
pradeepjain
by: pradeepjain | last post by:
imagecreatefromstring() : gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file\n in i am getting a error for a image function <?php error_reporting(E_ALL); $link =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.