1 | initial version |
There was a bug in my program, not in OpenCV. More lines of code were needed to find it. They draw those 2 white threshold lines:
i1 = peak_ind - 5;
if (i1 < 0) i1 = 0;
i2 = peak_ind + 5;
if (i2 >= histSize) i2 = histSize - 1;
line(histImage, Point(bin_w*i1, 0), Point(bin_w*i1, hist_h), Scalar(255, 255, 255), 1, 8, 0);
line(histImage, Point(bin_w*i2, 0), Point(bin_w*i2, hist_h), Scalar(255, 255, 255), 1, 8, 0);
You see that threshold window is different. If I change:
float peak_hue1 = peak_hue - 5 * bin_range;
float peak_hue2 = peak_hue + 5 * bin_range;
the result will be: