Here, we will make this simpler to use by specializing a class for the case of one-channel, gray-level images. For other types of images, you can always use the cv::calcHist function directly, which offers you all the flexibility that's required. The next section will explain each of its parameters. Then, we are going to implement our histogram class:
- Create a Histogram1D class, as follows:
// To create histograms of gray-level images class Histogram1D { private: int histSize[1]; // number of bins in histogram float hranges[2]; // range of values const float* ranges[1]; // pointer to the value ranges int channels[1]; // channel number to be examined public: Histogram1D() { // Prepare default arguments for 1D histogram histSize[0]= ...