33void Normalize(
const std::vector<float> &mean,
const std::vector<float> &
std,
34 float scale, cv::Mat *img) {
36 for (
const auto std_value :
std) {
40 (*img).convertTo(*img, CV_32FC3, scale);
42 for (
int h = 0; h < img->rows; ++h) {
43 for (
int w = 0; w < img->cols; ++w) {
44 img->at<cv::Vec3f>(h, w)[0] =
45 (img->at<cv::Vec3f>(h, w)[0] - mean[0]) /
std[0];
46 img->at<cv::Vec3f>(h, w)[1] =
47 (img->at<cv::Vec3f>(h, w)[1] - mean[1]) /
std[1];
48 img->at<cv::Vec3f>(h, w)[2] =
49 (img->at<cv::Vec3f>(h, w)[2] - mean[2]) /
std[2];