cv::sum refactoring