How to find average intensity of opencv contour in realtime

asked 2013-07-29 19:38:12 -0500

Ashok Elluswamy gravatar image

I have a image with about 50 to 100 small contours. I wish to find the average color of each of these contours in real-time (about 25, (960 x 480) pixel images per sec). Some of the ways I could think of was

  1. 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.
  2. Study OpenCV implementation of drawContour function and study their implementation of drawContour with the FILLED option. But the code seems really complex and not readily understandable.
  3. 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.

Is there an easier, efficient way to do this?

edit retag flag offensive close merge delete