title: Convert cv2.minAreaRect() output to contour for input to cv2.boundingRect()
body: <p>I've already tried a number of approaches to create a boundingRect() around a minAreaRect(), but I keep running into an error. I could simply use the original contour yes, but at this point it's a matter of understanding why a contour that works with cv2.isContourConvex() and cv2.drawContours() won't work with cv2.boundingRect(). Basically I'm trying to better understand the construction of a contour.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>import cv2
  import numpy as np
  
  # EX1: draw contour from minAreaRect() output
  mar = cv2.minAreaRect( contour )
  pts = cv2.cv.BoxPoints( mar )
  pts_contour = np.int0(pts)
  cv2.drawContours(mask, [pts_contour], 0, 255, -1)
  
  cv2.boundingRect( pts_contour )  # ERROR: see below
  
  # EX2: test contour convex
  contour = np.array([(378, 949), (375, 940), (368, 934), 
      (359, 932), (350, 937), (345, 955), (351, 962), (359, 966), (368, 964),
      (376, 958) ], dtype=np.int)
  print cv2.isContourConvex(contour)
  
  cv2.boundingRect( contour )  # ERROR: see below
  </code></pre>
  
  <p>EX1: Error from boundingRect(): OpenCV Error: Unsupported format or combination of formats (The image/matrix format is not supported by the function) in cvBoundingRect
    This example of converting to a contour was provided in the <a href="http://opencvpython.blogspot.it/2012/06/contours-2-brotherhood.html" rel="nofollow noreferrer">Rotated Rectangles section here</a></p>
  
  <p>EX2: Error from boundingRect(): OpenCV Error: Assertion failed (points.checkVector(2) >= 0 &amp;&amp; (points.depth() == CV_32F || points.depth() == CV_32S)) in boundingRect
    This example of creating a contour from scratch <a href="https://stackoverflow.com/questions/20928944/create-contour-from-scratch-in-python-opencv-cv2">was provided here</a></p>
  
  <p>Again I can accomplish my goals so I don't want suggestions on workarounds, but I would instead like to better understand the construct behind the contour and the error itself because I could see it being useful to create a boundingRect() from selected points</p>
  
  <p>Also, I don't know if it matters but I've noticed that there is a difference between the output from BoxPoints() and findContours()[0]:</p>
  
  <pre><code># BoxPoints:
  [[1051 1367]
  [ 968 1364]
  [ 977 1072]
  [1061 1074]]
  
  # findCountours()[0]:
  [[[ 992 1073]]
  [[ 991 1074]]
  [[ 989 1074]]
  [[ 988 1073]]]
  
  &gt;&gt;&gt; cv2.__version__
  '2.4.9'
  </code></pre>
  
  <p>cv2.boxPoints() is not available to me so I'm not sure if that would net me different results</p>