Opencv C++ 归一化
Opencv C++下的Mat归一化 void Mat_L2_mormal(cv::Mat &image) { //mat*mat, cv::Mat out; out=(image) .mul (image); float sum=0.0; for (int i=0;i<image.rows;i++){ sum=sqrt(cv::sum(out.row(i))[0]); image.row(i)=(image.row(i)/sum); } out.release(); } float scale = 0.0078125f ; float mean_value = 127.5f; void Mat_L2_mormal(cv::Mat &image) { for (int i = 0; i<image.rows; i++) { for (int j = 0; j<image.cols; j++) { image.at<Vec3b>(i, j)[0] = (image.at<Vec3b>(i, j)[0] - mean_value) * scale; image.at<Vec3b>(i, j)[1] = (image.at<Vec3b>(i, j)[1] - mean_value) * scale; image.at<Vec3b>(i, j)[2] = (image.at<Vec3b>