I want to normalize histogram between 0 and 1. Here is my code segment. It gave all zero output. Your help highly appreciable.
int main(..)
{
.....................................
float histogram_sample[1][6]={2.0,2.0,3.0,4.0,1.0,2.0};
Mat histogram(1,6,CV_32F,(void*)histogram_sample);
cout<<"Histogram Matrix:"<<histogram<<endl;
int histSize = 4;
float start=1.0;
float end=4.0;
float range[] = { start,end+1.0 } ;
const float* histRange = { range };
bool uniform = true; bool accumulate = false;
Mat hist;
calcHist( &histogram, 1, 0, Mat(), hist, 1, &histSize, &histRange, uniform, accumulate );
cout<<"hist:"<<hist<<endl;
normalize(hist, hist, 0, 1, NORM_L2, -1, Mat());
cout<<"Normalize hist:"<<hist<<endl;
}