Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ah! I noticed the real problem.

You store values in valuesb[0] through valuesb[histSize-2]. Because count = buckets-1, and buckets goes to histSize-1. So when you call find_mean, it looks at every value, including valuesb[histSize-1], which you never actually set.

If you're trying to find the mean of histg, why not use the cv::mean function? Or since you're actually calculating the sum+1, why not use cv::sum?