title: open cv2 converting color image to grayscale
body: <p>I am trying to convert color image to gray scale using Opencv2 library with python 3.7 using XAMPP server and the result is on the web is:</p>
  
  <pre><code>   no image --&gt; --&gt;
  
  
  error   Python 3.7.0: C:\Users\Asus\AppData\Local\Programs\Python\Python37-32\python.exe
  Fri Aug 24 21:58:51 2018
  A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
  
   C:\xampp\htdocs\cv2\rgbtogray.py in &lt;module&gt;()
       17         print ("no image")
       18 
  =&gt;   19 gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
       20 cv2.imshow('gray',gray)
       21 cv2.waitKey(0)
  gray undefined, cv2 = &lt;module 'cv2' from 'C:\\Users\\Asus\\AppData\\Lo...on37-32\\lib\\site-packages\\cv2.cp37-win32.pyd'&gt;, cv2.cvtColor = &lt;built-in function cvtColor&gt;, img = None, cv2.COLOR_BGR2GRAY = 6
  error: OpenCV(3.4.2) d:\build\opencv\opencv-3.4.2\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) &amp;&amp; VDcn::contains(dcn) &amp;&amp; VDepth::contains(depth) in function 'cv::CvtHelper&lt;struct cv::Set&lt;3,4,-1&gt;,struct cv::Set&lt;1,-1,-1&gt;,struct cv::Set&lt;0,2,5&gt;,2&gt;::CvtHelper' 
        args = ("OpenCV(3.4.2) d:\\build\\opencv\\opencv-3.4.2\\modul...et&lt;1,-1,-1&gt;,struct cv::Set&lt;0,2,5&gt;,2&gt;::CvtHelper'\n",) 
  </code></pre>
  
  <p>here is the code i executed using xampp</p>
  
  <pre><code>#!C:\Users\Asus\AppData\Local\Programs\Python\Python37-32\python.exe
  
  print('Content-type: text/html\r\n')
  print('\r\n')
  
  import cgitb
  import cv2
  import numpy as np
  
  cgitb.enable()
  
  
  img = cv2.imread('C:\\xampp\\htdocs\\cv2\\color.png')
  if img is None:
      print ("no image")
  
  gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
  cv2.imshow('gray',gray)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Av3AB.png" rel="nofollow noreferrer">here is the image i want to convert</a></p>