[OpenCV • c++] Custom histogram | Grayscale histogram equalization | Color histogram equalization

1. What is a histogram?

  Histograms are widely used in many computer vision processes. Scene changes in a video can be detected by marking significant edges and color changes from frame to frame. Setting a "label" consisting of a histogram with similar characteristics at each point of interest can be used to mark various things, such as the color distribution of the image, the gradient template of the object edge, etc. It is one of the most classic tools in computer vision.
  Simply put, a histogram is a method of statistics on data, which organizes statistical values ​​into a series of predefined values bin. binThe values ​​in are statistics of features calculated from the data, which can be gradients, directions, colors, or any other feature. The histogram obtains a statistical diagram of the data distribution. Usually, the dimension of the histogram is lower than the original data. Since raw data can represent anything, a histogram can represent the characteristics of an image very well.

2. Customized histogram

  In actual application scenarios, we can adjust the calculated histogram interval according to needs. For the grayscale histogram, we can divide the interval [0, 255] into five intervals [0,60], [61,120], [121,160], [161,220], [221,255]. Then the grayscale distribution of each interval is counted separately to further implement a custom histogram.

  The following is an implementation example of a custom histogram:

Guess you like

Origin blog.csdn.net/Ceylan__/article/details/133079820
Recommended