contrast image

Hi,
   I try to apply contrast to an image with set_cmap() like it's explained
in this page http://matplotlib.sourceforge.net/users/image_tutorial.html
http://matplotlib.sourceforge.net/users/image_tutorial.html but when I
apply a new pseudocolor nothing appends. Please help me! This is my code.

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.cm as cm
import numpy as np
import sys

turno=0
pixel=0
img16=open(sys.argv[1],'r')
r=img16.read(2)
val=[]
i=0
riga=[]
while r !="":
  if (pixel>=0) & (pixel<510):
    r1=ord(r[0])
    r2=(ord(r[1])&15)<<8
    ris=(float(r1|r2))/4095
    riga.append([ris,ris,ris])
  else:
    if pixel==511:
      val.append(riga)
      riga=[]
  pixel=(pixel+1)%512
  r=img16.read(2)
#for i in range(512):
# print len(val[i])
# print val[i]
val=np.array(val,dtype=np.float32)
imgplot = plt.imshow(val)
imgplot.set_cmap(cm.binary)
plt.show()

···

--
View this message in context: http://old.nabble.com/contrast-image-tp32503930p32503930.html
Sent from the matplotlib - users mailing list archive at Nabble.com.