title: Unsupported format or combination of formats) ,FindContours
body: <p>I want to count the cars by using haar cascade.</p>
  
  <pre><code>#import libraries of python opencv
  import numpy as np 
  import cv2
  import gc
  import uuid
  import datetime
  import time
  import csv
  
  cap = cv2.VideoCapture('v3.mp4')
  
  car_cascade = cv2.CascadeClassifier('cars.xml') 
  W = cap.get(3)
  H = cap.get(4)
  areaTH = 700
  
   H1 = (H/2)+10
  W1 = W/2
  mx = 0
  my = 30
  
  while (cap.isOpened()):
  #capture frame by frame
  ret, frame = cap.read()
  
  #convert video into gray scale of each frames
  
  gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  
  #detect cars in the video
  cars = car_cascade.detectMultiScale(gray, 1.1, 3)
  
  
  #to draw arectangle in each cars 
  for (x,y,w,h) in cars:
      cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)      
  
  #display the resulting frame
  cv2.imshow('video', frame)
  #press Q on keyboard to exit
  if cv2.waitKey(25) &amp; 0xFF == ord('q'):
      break
  
  Line1 = np.array([[20,H1],[310,H1]], np.int32).reshape((-1,1,2))
  frame = cv2.polylines(frame,[Line1],False,(0,0,255),thickness=5)
  fram, contours0, hierarchy = 
  cv2.findContours(frame,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)
  for cnt in contours0:
     # cv2.drawContours(frame, cnt, -1, (0,255,0), 2, 8)
      area = cv2.contourArea(cnt)
      #print ('Area : '+str(area))
  
      if area &gt; areaTH:
          #################
          #   TRACKING    #
          #################            
          M = cv2.moments(cnt)
          cx = int(M['m10']/M['m00'])
          cy = int(M['m01']/M['m00'])
          x,y,w,h = cv2.boundingRect(cnt)
          cv2.circle(frame,(cx,cy), 3, (255,0,0), -1)            
          img = cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)
          #print ('H1 : '+str(H1))
          print('cy : '+str(cy))
  
          if (cy &gt;= 147) and (cy&lt;= 155):
              Vehicles = Vehicles + 1
              Line1 = np.array([[200,H1],[880,H1]], 
      np.int32).reshape((-1,1,2))
              frame = cv2.polylines(frame,[Line1],False,(255,0,0),thickness=5)
  
  
          cv2.imshow('Frame',frame)
  
     #Abort and exit with 'Q' or ESC
     k = cv2.waitKey(30) &amp; 0xff
     if k == 27:
      break
  
  cap.release() #release video file
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>I convert the image properly to gray-scale and successfully drawn a line on the frame the problem is that I am getting  this error</p>
  
  <blockquote>
    <p>error: OpenCV(3.4.2) C:\build\3_4_winpack-bindings-win32-vc14-static\opencv\modules\imgproc\src\contours.cpp:199: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'</p>
  </blockquote>
  
  <p>when ever i pass a variable 'frame' in this code line can somebody help me to solve this error thanx</p>
  
  <pre><code>fram, contours0, hierarchy = 
  cv2.findContours(frame,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)
  </code></pre>