src data type 17 not supported error with OpenCV Python
<p>I want to take screenshots of a particular region of my screen with ImageGrab and convert the image to a numpy array to analyze with OpenCV. However I stumbled upon a src data type 17 error which I keep getting only at random when I change the parameters of the grab function. So for example when the parameters are: (10, 10, 50, 40) it prints out a normal numpy array which can then be converted to grayscale with opencv, however with other parameters such as: (100, 100, 100, 100) it keeps giving a <code>src data type = 17 is not supported error</code>. When I try to print out the numpy array it also doesn't show the array but only place in memory with size 0x0, for example: <code>&lt;PIL.Image.Image image mode=RGB size=0x0 at 0x532C570&gt;</code> Below is example of the code. Appreciate it if anybody could help me explain why this happens and perhaps suggest the fix for it.</p>

<pre><code>import cv2
import numpy as np
from PIL import ImageGrab

while True:
    img = ImageGrab.grab(bbox=(10, 10, 50, 40))
    img_np = np.array(img)
    print img_np
    #img_grayscaled = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY)
</code></pre>