title: PIL image in grayscale to OpenCV format
body: <p>I found the previous answer related to a more general conversion from RGB image here: <a href="https://stackoverflow.com/questions/14134892/convert-image-from-pil-to-opencv-format">Convert image from PIL to openCV format</a></p>
  
  <p>I would like to know the difference when an image has to be read as a grayscale format.</p>
  
  <pre><code>images = [None, None]
  
  images[0] = Image.open('image1')
  images[1] = Image.open('image2')
  
  print(type(images[0]))
  
  a = np.array(images[0])
  b = np.array(images[1])
  
  print(type(a))
  
  im_template = cv2.imread(a, 0)
  im_source = cv2.imread(b, 0)
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>&lt;class 'PIL.JpegImagePlugin.JpegImageFile'&gt;
  &lt;class 'numpy.ndarray'&gt;
  </code></pre>
  
  <p>Even though I am able to convert the image to ndarray, cv2 says: "bad argument type for built-in operation". I do not need an RGB to BGR conversion. What else should I consider while passing a cv2 read argument?</p>