title: Create colour picture from greyscale picture
body: <p>I have a matrix with values from 0 to 1000, I can easily scale the values to the 0~255 range, and that is a greyscale picture if I show the matrix in opencv from Python.</p>
  
  <p>The question is, how do I convert the Matrix {Dimensions = (m, n)} to a 3-layer matrix array {Dimensions = (m, n, 3)}?  </p>
  
  <p>This is, how to convert a greyscale picture to a colour picture?</p>
  
  <p>I have made this function but it is not working</p>
  
  <pre><code> import matplotlib.pyplot as plt
   from itertools import product  
  
   def convertPicturetoColor(self, image, cmap=plt.get_cmap('rainbow')):
       '''
       Converts a greyscale [0~255] picture to a color picture
       '''
       a, b = np.shape(image)
       m = np.zeros((a, b, 3))
       for i, j in product(xrange(a), xrange(b)):
           m[i,j,:] = np.array(cmap(image[i,j]))[0:3]
       return m
  </code></pre>