title: OpenCV boundingRect() function throws unexpected error
body: <p>My goal is to have a working script for identifying a table on an image. I stumbled upon this posts answer: <a href="https://stackoverflow.com/a/51756462/10434683">https://stackoverflow.com/a/51756462/10434683</a>
  He is exactly doing what I need. However if I run this code I get an error that looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/ZUAvQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZUAvQ.png" alt="enter image description here"></a></p>
  
  <p>It seems like the error is caused by the boundingRect() function. Ive looked up the docs, however didnt find anything useful. </p>
  
  <p>The following is the function where boundingRect() is used...</p>
  
  <pre class="lang-py prettyprint-override"><code>def find_text_boxes(pre, min_text_height_limit=6, max_text_height_limit=40):
      # Looking for the text spots contours
      contours = cv2.findContours(pre, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
      contours = contours[0] if imutils.is_cv2() else contours[1]
  
      # Getting the texts bounding boxes based on the text size assumptions
      boxes = []
      for contour in contours:
          box = cv2.boundingRect(contour) #error
          h = box[3]
  
          if min_text_height_limit &lt; h &lt; max_text_height_limit:
              boxes.append(box)
  
      return boxes
  </code></pre>