title: Error with cv2.minAreaRect , gives me Error related to convex hull function which i haven't used
body: <p>In the code below I have tried to find out if an object is green in colour and draw a contour around it. With that information I would also like to find the corners of the shape and crop it, but I get an error related to the ConvexHull function which I have not used in the code. I have used python 3 and Opencv 3.2.0 </p>
  
  <p>The code that I have written gives me this error </p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/pi/Desktop/SelfDrivingCar/code/picamsense2.py", line 29, in &lt;module&gt;
      points = cv2.minAreaRect(contour)
  error: /home/pi/opencv/opencv-3.2.0/modules/imgproc/src/convhull.cpp:136: error: (-215) total &gt;= 0 &amp;&amp; (depth == CV_32F || depth == CV_32S) in function convexHull
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>from picamera import PiCamera
  import time
  import cv2
  import numpy as np 
  camera = PiCamera()
  camera.start_preview()
  time.sleep(5)
  camera.capture('/home/pi/Desktop/piImage/image.jpg')
  camera.stop_preview()
  img = cv2.imread('/home/pi/Desktop/piImage/image.jpg', 1)
  hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
  lower = np.array([46, 100, 100])
  upper = np.array([86, 255, 255])
  mask = cv2.inRange (hsv, lower, upper)
  blur = cv2.GaussianBlur(mask, (7,5),0 )
  erosion =cv2.erode(blur, (5,5), iterations = 3)
  contour =np.array( cv2.findContours(erosion, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[1])
  cv2.drawContours(img, contour, -1, (0,255,0), 3)
  for cnt in contour:
      approx = cv2.approxPolyDP(cnt, 0.04*cv2.arcLength(cnt, True), True)
      if len (approx)== 3:
          print "triangle"
      elif len (approx) == 4 :
          print "quadrilateral"
      elif len(approx) &gt; 4:
          print "circle"        
  points = cv2.minAreaRect(contour)
  points = cv2.boxPoints(points)
  points = np.int0(points)
  for p in points :
      pt = (p[0],p[1])
      print pt
  print points
  cv2.imshow('eroded', blur)
  cv2.imshow('original', img)
  while (1):
      k = cv2.waitKey(0)
      if(k == 27):
       break
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>I have been trying to look for a fix for quiet some time now </p>
  
  <p>Any help would be appreciated </p>
  
  <p>thanks in advance </p>
  
  <p>-Sam</p>