calcHist() with CV_32F
Hello,
To compute a histogram of a CV_8U image (values between 0 and 255) knowing that the upper boundary in histRange
is exclusive, we have
int histSize = 256;
float range[] = { 0, 256 } ;
const float* histRange = { range };
calcHist( &image, 1, 0, Mat(), histogram, 1, &histSize, &histRange );
Now assume I have an CV_32F image with values between (and including) 0 and 255 and I want to build a histogram with histSize = 1000. If the upper boundary of histogram ranges is exclusive then how to specify it properly not to lose the maximum value (255)?
I tried the code below but I'm not sure if I'm right
int histSize = 1000;
float binSize = (255 - 0) / histSize;
float range[] = { 0, 255 + binSize } ;
const float* histRange = { range };
calcHist( &image, 1, 0, Mat(), histogram, 1, &histSize, &histRange );