title: How to find average intensity of OpenCV contour in realtime
body: <p>I have a image with about 50 to 100 small contours. I wish to find the average intensity[1] of each of these contours in real-time[2]. Some of the ways I could think of was</p>
  
  <ol>
  <li><p>Draw contour with FILLED option for each contour; use each image as a mask over the original image, thus find the average. But I presume that this method won't be real-time at first glance.</p></li>
  <li><p>Study OpenCV implementation of <code>drawContour</code> function with the FILLED option and access the pixels enclosed by the contour in the same manner. But the code seems really complex and not readily understandable. </p></li>
  <li><p>Calculate the minimum area rectangle, find all the points inside the rectangle using transformation, and find average of points that are non-zero. Again, seems complex approach.</p></li>
  </ol>
  
  <p>Is there an easier, efficient way to do this?</p>
  
  <p>[1] Average of all pixel intensities enclosed by each of the non-overlapping contours</p>
  
  <p>[2] About 25, (960 x 480) pixel images per sec on a 2.66 Ghz desktop PC</p>