title: Is there a way to use minAreaRect from OpenCV with double?
body: <p>I'm working within a 3D environment and a camera so that I have some 3D coordinates on one side and playing around with OpenCV on the other side.</p>
  
  <p>I need to find a minimal bounding rectangle to a polygon, considering 2D coordinates and would like to use OpenCV for that.</p>
  
  <p>The issue is that my coordinates are represented in double.</p>
  
  <p>I tried:</p>
  
  <pre><code>  std::vector&lt;cv::Point2d&gt; poly {{1.1, 2.2}, {3.3, 4.4}, {5.5, 6.6}, {7.7, 8.8}};
    cv::RotatedRect box = cv::minAreaRect(poly); // crashes here
  
    cv::Point2f corners[4];
    box.points(corners);
  </code></pre>
  
  <p>but got the following error:</p>
  
  <blockquote>
    <p>OpenCV Error: Assertion failed (points.checkVector(2) >= 0 &amp;&amp; (points.depth() == CV_32F || points.depth() == CV_32S)) in minAreaRect, file /build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/contours.cpp, line 1913</p>
  </blockquote>
  
  <p>If I use some <code>Point</code> instead of <code>Point2d</code> the coordinates of the resulted rectangle are truncated</p>
  
  <pre><code>// narrowing conversions
  std::vector&lt;cv::Point2d&gt; poly {{1.1, 2.2}, {3.3, 4.4}, {5.5, 6.6}, {7.7, 8.8}};
  cv::RotatedRect box = cv::minAreaRect(poly);
  
  cv::Point2f corners[4];
  box.points(corners);
  </code></pre>
  
  <p>I'm not hundred percent sure if I'm using OpenCV the right way but I stumbled upon this and would like to avoid writing my own Rotating Calipers function.</p>
  
  <p>Thanks !</p>