title: Error in OpenCV color conversion from BGR to grayscale
body: <p>I am trying to convert an image from BGR to grayscale format using this code:</p>
  <pre><code>img = cv2.imread('path//to//image//file')
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  </code></pre>
  <p>This seems to be working fine: I checked the data type of the <code>img</code> variable which turns out to be numpy ndarray and shape to be <code>(100,80,3)</code>. However if I give an image of a native numpy ndarray data type with same dimensions of the input of the <code>cvtColor</code> function, it gives me the following error:</p>
  <pre><code>Error: Assertion failed (depth == 0 || depth == 2 || depth == 5) in cv::cvtColor, file D:\Build\OpenCV\opencv-3.4.1\modules\imgproc\src\color.cpp, line 11109
  cv2.error: OpenCV(3.4.1) D:\Build\OpenCV\opencv-3.4.1\modules\imgproc\src\color.cpp:11109: error: (-215) depth == 0 || depth == 2 || depth == 5 in function cv::cvtColor
  </code></pre>
  <p>The code for the second case is (making a custom <code>np.ndarray</code> over here):</p>
  <pre><code>img = np.full((100,80,3), 12)
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 
  </code></pre>
  <p>Can anyone clarify what is the reason for this error and how to rectify it?</p>