title: How to correctly pass an image as an argument to a class in opencv python
body: <p>I am a newbie to python and opencv and when I try to run this code I get an error in the colors method while converting <code>BGR</code> to <code>HSV</code> as </p>
  
  <pre><code>hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
  
  cv2.error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\imgproc\src\color.cpp:7646: 
  error: (-215) (scn == 3 || scn == 4) &amp;&amp; (depth == CV_8U || depth == CV_32F) in function cv::ipp_cvtColor
  </code></pre>
  
  <p>Even if I comment that part out and only run the part where it is simply returning the image as it is, it gives an error while displaying the image in cv2.imshow() as</p>
  
  <pre><code>cv2.imshow('image',res)
  
  cv2.error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\highgui\src\window.cpp:281: 
  error: (-215) size.width&gt;0 &amp;&amp; size.height&gt;0 in function cv::imshow
  </code></pre>
  
  <p>Please help me figure out if I'm missing out on something.</p>
  
  <pre><code>class basicop:
  @staticmethod
  def colors(color, frame):
      if(color=='red'):
          lower = np.array([0, 100, 100])
          upper= np.array([10, 255, 255])
      elif(color=='green'):
          lower = np.array([86, 36, 99])
          upper= np.array([86, 255, 255])
      #CONVERT BGR TO HSV
      hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
      mask = cv2.inRange(frame, lower, upper)
      res = cv2.bitwise_and(frame, frame, mask= mask)
      return frame
  
  frame= cv2.imread('gree.jpg')
  res=basicop.colors('green', frame)
  cv2.imshow('image', res)
  k = cv2.waitKey(0)
  if k == 27:        
      cv2.destroyAllWindows()
  elif k == ord('s'): 
      cv2.imwrite('sanj.jpg', res)
      cv2.destroyAllWindows()
  </code></pre>