title: cv2.error : OpenCV(4.5.3) Error: bad argument & overload resolution failed in cv.line
body: <p>I have a simple project with Raspi 4 with camera which the project is similar with car's reverse camera but without sensor. Here my code:</p>
  <pre class="lang-python prettyprint-override"><code>import time
  import cv2
  import numpy as np
  from picamera.array import PiRGBArray
  from picamera import PiCamera
  
  camera = PiCamera()
  camera.resolution = (1080, 720) # camera resolution 
  camera.framerate = 25
  rawCapture = PiRGBArray(camera, size=(1080,720))
  kernel = np.ones((2,2),np.uint8)
  time.sleep(0.1)
  for still in camera.capture_continuous(rawCapture, format=&quot;bgr&quot;, use_video_port=True):
      
      image = still.array
      #create a detection area
      widthAlert = np.size(image, 1) #get width of image
      heightAlert = np.size(image, 0) #get height of image
      yAlert = (heightAlert/2) + 100 #determine y coordinates for area
      cv2.line(image, (0,yAlert), (widthAlert,yAlert),(0,0,255),2) #draw a line to show area
      
      lower = [1, 0, 20]
      upper = [60, 40, 200]
      lower = np.array(lower, dtype=&quot;uint8&quot;)
      upper = np.array(upper, dtype=&quot;uint8&quot;)
      #use the color range to create a mask for the image and apply it to the image
      mask = cv2.inRange(image, lower, upper)
      output = cv2.bitwise_and(image, image, mask=mask)
      
      dilation = cv2.dilate(mask, kernel, iterations = 3)
      closing = cv2.morphologyEx(dilation, cv2.MORPH_GRADIENT, kernel)
      closing = cv2.morphologyEx(dilation, cv2.MORPH_CLOSE, kernel)
      edge = cv2.Canny(closing, 175, 175)
      
      contours, hierarchy = cv2.findContours(closing, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
      
      threshold_area = 400
      centres = []
      
      if len(contours) !=0:
          
          for x in contours:
              #find the area of each contour
              area = cv2.contourArea(x)
              #find the center of each contour
              moments = cv2.moments(x)
              #weed out the contours that are less than our threshold
              if area &gt; threshold_area:
                  
                  (x,y,w,h) = cv2.boundingRect(x)
                  
                  centerX = (x+x+w)/2
                  centerY = (y+y+h)/2
                  
                  cv2.circle(image,(centerX, centerY), 7, (255, 255, 255), -1)
                  
                  if ((y+h) &gt; yAlert):
                      cv2.putText(image, &quot;ALERT!&quot;, (centerX -20, centerY -20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255),2)
      
      cv2.imshow(&quot;Display&quot;, image)
      
      rawCapture.truncate(0)
      
      key = cv2.waitKey(1) &amp; 0xFF
      if key == ord(&quot;q&quot;):
          break
  </code></pre>
  <p>The error i got is in:</p>
  <pre class="lang-python prettyprint-override"><code> image = still.array
      #create a detection area
      widthAlert = np.size(image, 1) #get width of image
      heightAlert = np.size(image, 0) #get height of image
      yAlert = (heightAlert/2) + 100 #determine y coordinates for area
      cv2.line(image, (0,yAlert), (widthAlert,yAlert),(0,0,255),2) #draw a line to show area
  </code></pre>
  <p>The problem is:
  Traceback (most recent call last): File &quot;/home/pi/Desktop/object_detector.py&quot;, line 20, in </p>
  <p>cv2.line(image, (0,yAlert), (widthAlert,yAlert),(0,0,255),2) #draw a line to show area</p>
  <p>cv2.error: OpenCV(4.5.3)  error: (-5:Bad argument) in function 'line'</p>
  <p>Overload resolution failed:</p>
  <p>-can't parse 'pt1'. Sequence item with index 1 has wrong type</p>
  <p>-can't parse 'pt1'. Sequence item with index 1 has wrong type</p>