Hi,

I am tryin to copy an image into my own data structure(a sort of 2d array for further FFT). I've banged my head over the code for a couple of hours now. The simplified version of my problem is below.

#-----------------Code------------------------

import Image
pic = Image.open("Images/a.jpg")
(picdata,width,height)  = (pic.load(),pic.size[0],pic.size[1])

picMap = [[0] * width ] * height        #matrix needed for FFT

print "------Printing PIC MAP------"
for h in range(0,height):
    for w in range(0,width):
print picMap[h][w]," ", #everything initialized to ZERO...this is ok
    print "\n"


print "------Copying to  PIC MAP------"
for h in range(0, height):
    for w in range(0, width):
        picMap[h][w] = picdata[w,h] #problem lies here????
print picMap[h][w]," ", #Seems to copy perfectly here as the output shows
    print "\n"


print "------Printing PIC MAP AGAIN------"
for h in range(0,height):
    for w in range(0,width):
print picMap[h][w]," ", #Should print the values as above, but doesn't
    print "\n"

#-----------------Code End------------------------

Hopefully someone would take a look and let me know what i'm doing something wrong here.

Thanks a lot
-Sid
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to