title: Find the biggest Contour- OpenCV, Python - Getting Errors
body: <p>I am trying to find the biggest contour around a car in an image. <br>To find the contour I have learnt the following from the official OpenCv documentation:<br></p>
  
  <pre><code> #convert the image to grayscale from rgb 
   1. image_gray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
   2. threshold  = cv2.threshold(image_gray, 127,(0,255,0),0)
   3. image2, contours_list, hierarchy = cv2.findContours(threshold, cv2.RETR_LIST, cv2.CHAIN_APROX_SIMPLE)
  </code></pre>
  
  <p>problem -1: <br> 
  I have already applied cv2.GaussianBlur() and converted it to HSV format to create masks to detect some specific color later using MorphologyEx methods. The Problem is, the code in step 2 above requires the image either in RGB format to convert it to Gray scale or the Gray format itself but I have HSV format for which there's no such flag as cv2.COLOR_HSV2GRAY. </p>
  
  <p>I have written the following 2 versions of the same method to find the biggest contour and they are throwing 2 different errors: <br>
  In this method, I am first creating a threshold, which requires a GRAY scale image, to pass to the cv2.findContour method</p>
  
  <pre><code>def find_biggest_contour(image):
     image = image.copy() 
     #1
     image_gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
     #2 
     threshold = cv2.threshold(image_gray,127, 255,0)
     #3
     image2, contours, heirarchy = cv2.findContours(threshold, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) # countours is a python list
     contours_sizes= [(cv2.contourArea(cnt), cnt) for cnt in contours]
     biggest_contour = max(contours_sizes, key=lambda x: x[0])[1]
     #define a mask
     mask = np.zeros(image.shape, np.uint8)
     cv2.drawContours(mask,[biggest_contour], -1, (0,255,0), 3)# 3=thickness, -1= draw all contours, 2nd arg must be a list 
     return biggest_contour, mask
  </code></pre>
  
  <p>this method is throwing me the following error:<br><a href="https://i.stack.imgur.com/u1ZtP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u1ZtP.png" alt="error for the 1st version of method"></a>
  The other version is as follows(basically, I have taken it from somewhere): <br></p>
  
  <pre><code>def find_biggest_contour(image):
     image = image.copy()
     im2,contours, hierarchy = cv2.findContours(image, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
  
     contour_sizes = [(cv2.contourArea(contour), contour) for contour in contours]
     biggest_contour = max(contour_sizes, key=lambda x: x[0])[1]
  
     mask = np.zeros(image.shape, np.uint8)
     cv2.drawContours(mask, [biggest_contour], -1, 255, -1)
     return biggest_contour, mask
  </code></pre>
  
  <p>This method throws the following error:<br><a href="https://i.stack.imgur.com/omhDp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/omhDp.png" alt="error for the 2nd version of method "></a></p>
  
  <p>Kindly help me fix the errors. I am new to opencv. </p>