I am new in opencv and I want to calculate HSV histogram. I am refering the code provided in this link. https://docs.opencv.org/3.0-beta/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.html
I am using opencv version 3.3.1 and facing the following errors errors.
Using the same code, I did not do anychanges in the code except changing the image for HSV histogram. Where detectPerson is the video frame and hsv is cv mat object.
Anyone plzz help I am stuck here.
int h_bins = 50, s_bins = 60;
int histSize[] = {h_bins, s_bins};
// hue varies from 0 to 179, saturation from 0 to 255
float h_ranges[] = { 0, 180 };
float s_ranges[] = { 0, 256 };
const float* ranges[] = { h_ranges, s_ranges };
// Use the 0-th and 1-st channels
int channels[] = { 0, 1 };
cv::Mat hist_hsv, hist_hsv2;
cvtColor(detectPerson, hsv, COLOR_BGR2HSV );
calcHist( &hsv, 1, 0, Mat(), hist_hsv, 2, histSize, ranges, true, false );
normalize( hist_hsv, hist_hsv, 0, 1, NORM_MINMAX, -1, Mat() );
Errors
int channels[] = { 0, 1 };
error: too many initializers for 'int [0]'
int histSize[] = {h_bins, s_bins}
error: too many initializers for 'int [0]'
float h_ranges[] = { 0, 180 };
error: too many initializers for 'float [0]'
float s_ranges[] = { 0, 256 };
error: too many initializers for 'float [0]'