title: Draw rotated bounding box on image without fixed angle
body: <p>Im new to programming and opencv and i try to detect a hdd using color segmentation.  My code so far loads an image, creates 3 masks with different colors and draws an upright bounding box around the non zero points:     </p>
  
  <pre><code>int main( int argc, char** argv )
  {
  
  //Load the image
  Mat img = imread(argv[1], 1);
  if (img.empty()){
  cout &lt;&lt; "No image found..." &lt;&lt; endl;
  return -1;
  }
  
  //Extracting colors - BGR
  Mat silver, white, black;
  
  //Silver
  inRange(img, Scalar(180, 180, 180), Scalar(200, 200, 200), silver);
  
  //White
  inRange(img, Scalar(240, 240, 240), Scalar(255, 255, 255), white);
  
  //Black
  inRange(img, Scalar(0, 0, 0), Scalar(30, 30, 30), black);
  
  // logical OR mask
  Mat1b mask = silver | white | black;
  
  // Find non zero pixels
  vector&lt;Point&gt; pts;
  
  findNonZero(mask, pts);
  
  cout &lt;&lt; "Non-Zero Locations = " &lt;&lt; pts &lt;&lt; endl &lt;&lt; endl; // get non zero coordinates
  
  // Compute bounding box
  
  Rect box = boundingRect(pts);
  
  // Show bounding box
  rectangle(img, box, Scalar(0, 0, 255), 3);
  namedWindow("box", CV_WINDOW_NORMAL);
  imshow("box", img); 
  imshow("mask", mask);
  
  waitKey(0);
  destroyAllWindows;
  
  return 0;}
  </code></pre>
  
  <p>Now I want to draw the smallest bounding box, so I tried to use </p>
  
  <pre><code>cv::RotatedRect box2 = cv::minAreaRect(pts);
  </code></pre>
  
  <p>instead. But it doesnt compile when I try to visualize that by replacing</p>
  
  <pre><code>Rect box = boundingRect(pts); 
  </code></pre>
  
  <p>with</p>
  
  <pre><code>RotatedRect box2 = minAreaRect(pts);
  </code></pre>
  
  <p>Error Output:</p>
  
  <pre><code>error: no matching function for call to ‘rectangle(cv::Mat&amp;, cv::RotatedRect&amp;, cv::Scalar, int)’
   rectangle(img, box2, Scalar(0, 0, 255), 3);
  </code></pre>