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
- 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.
- 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.
- 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?