First time here? Check out the FAQ!
answered 2017-05-11 05:51:48 -0600
please use meanStdDev() to find the average pixel value of your ROI, DO NOT WRITE YOUR OWN LOOPS !
Mat roi = img(selectRect); Scalar m,s; meanStdDev(roi, m, s); double avgPixel = m[0];