title: TypeError: src data type = 17 is not supported
body: <p>I'm now in a program try to change pictures from normal to binaryzation.So i use opencv on python, but when i finish my problem in my home carry my code to my office it come up with a unknown error.So i come to here ,looking for help.</p>
  
  <pre><code>from PIL import Image
  import numpy as np
  import matplotlib.pyplot as plt
  import cv2
  im = Image.open('card.jpg')
  img = np.array(im)
  if img.ndim == 3:
      img = img[:, :,0]
      plt.gray()
  ret, thresh1 = cv2.threshold(img, 50, 255, cv2.THRESH_BINARY)
  
  
  plt.subplot(222)
  plt.imshow(thresh1)
  plt.show()
  </code></pre>
  
  <p>The traceback is</p>
  
  <blockquote>
    <p>Traceback (most recent call last): File "D:/tensorflow/opencv.py", line 12, in  ret, thresh1 = cv2.threshold(img, 50, 255, cv2.THRESH_BINARY) TypeError: src data type = 17 is not supported </p>
  </blockquote>