title: Count percentage of white pixels inside of RotatedRect OpenCV
body: <p>how can I calculate percentage of white pixels inside of cv::RotatedRect? I mean, how to access single pixel inside of my cv::RotatedRect. If i'd reach that, i'd know what to do later. Thanks</p>
  
  <p>I've tried solution from this thread, but I've had exceptions. <a href="https://stackoverflow.com/a/28780359">https://stackoverflow.com/a/28780359</a></p>
  
  <pre><code>    std::vector&lt;cv::RotatedRect&gt; minRect(count.size());
      for (int i = 0; i &lt; count.size(); i++)
      {
          minRect[i] = cv::minAreaRect(cv::Mat(count[i]));
      }
      for (size_t i = 0; i &lt; count.size(); i++){
          if (cv::contourArea(count[i]) &gt; 200) {
              cv::Point2f rect_points[4];
              minRect[i].points(rect_points);
              // Now I'd like to calculate percentage of white pixels inside of RotatedRect, and if value returned by func would be smaller than 30%,continue;
              for (int j = 0; j &lt; 4; j++) {
                  cv::line(mask, rect_points[j], rect_points[(j + 1) % 4], (0, 255, 0), 1, 8);
              }
          }
  
      }
  </code></pre>