title: pyplot.imsave() saves image correctly but cv2.imwrite() saved the same image as black
body: <pre><code>from scipy.misc import imread
  from matplotlib import pyplot
  
  import cv2
  from cv2 import cv
  
  from SRM import SRM ## Module for Statistical Regional Segmentation
  
  im = imread("lena.png") 
  im2 = cv2.imread("lena.png")
  print type(im), type(im2), im.shape, im2.shape 
  ## Prints &lt;type 'numpy.ndarray'&gt; &lt;type 'numpy.ndarray'&gt; (120, 120, 3) (120, 120, 3)
  
  srm = SRM(im, 256)
  segmented = srm.run()
  
  srm2 = SRM(im2, 256)
  segmented2 = srm2.run()
  
  pic = segmented/256
  pic2 = segmented2/256
  
  pyplot.imshow(pic)
  pyplot.imsave("onePic.jpg", pic)
  
  pic = pic.astype('uint8')
  cv2.imwrite("onePic2.jpg", pic2)
  
  pyplot.show()
  </code></pre>
  
  <p><code>onePic.jpg</code> gives the correct segmented image but <code>onePic2.jpg</code> gives a complete black image.
  Converting the datatype to <code>uint8</code> using <code>pic = pic.astype('uint8')</code> did not help. I still gives a black image!</p>
  
  <p>onePic.jpg using <code>pyplot.imsave()</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/p4LDK.jpg" alt="enter image description here"></p>
  
  <p>onePic2.jpg using <code>cv2.imwrite()</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/DdPgN.jpg" alt="enter image description here"></p>
  
  <p>Please help!</p>