# Revision history [back]

As far as I know, the only thing that compareHist requests is that the data type of your output and input matrix are of type CV_32F, which means you use float data, instead of uchar, integer or double.

Basically only a typecast should suffice.

Could you add the following lines before the normalize command

hist_temp.convertTo(hist_temp, CV_32F);
hist_rgb.convertTo(hist_temp, CV_32F);


Then the following normalization will work just fine

cv::normalize( hist_temp, hist_rgb, 1.0, 0.0, cv::NORM_L1 );


As far as I know, the only thing that compareHist requests is that the data type of your output and input matrix are of type CV_32F, which means you use float data, instead of uchar, integer or double.

Basically only a typecast should suffice.

Could you add the following lines before the normalize command

hist_temp.convertTo(hist_temp, CV_32F);
hist_rgb.convertTo(hist_temp, CV_32F);


Then the following normalization will work just fine

cv::normalize( hist_temp, hist_rgb, 1.0, 0.0, cv::NORM_L1 );


Also be sure that both histograms have same size initialization before the normalization.