Understanding back-projection images
Apart from the visual information in a histogram, there is a more important use for it. This is called back-projection of a histogram, which can be used to modify an image using its histogram, or as we'll see later on in this chapter, to locate objects of interest inside an image. Let's break it down further. As we learned in the previous section, a histogram is the distribution of pixel data over the image, so if we somehow modify the resulting histogram and then re-apply it to the source image (as if it was a lookup table for pixel values), the resulting image would be considered the back-projection image. It is important to note that a back-projection image is always a single-channel image in which the value of each pixel is fetched from its corresponding bin in the histogram.
Let's see this as another example. First of all, here is how a back-projection is calculated in OpenCV:
calcBackProject(&image, 1, channels, histogram...