Applying this equalization process to
Figure 6-18 yields the equalized intensity distribution histogram and resulting image in Error! Reference
source not found..
Figure 6-21: Histogram equalized results: the spectrum has been spread out
cv::equalizeHist(), Contrast Equalization
OpenCV wraps this whole process up in one neat function.
void cv::equalizeHist(
const cv::InputArray src, // Input Image
cv::OutputArray dst // Result image
);
In cv::equalizeHist(), the source src must be a single-channel, 8-bit image. The destination image
dst will be the same. For color images you will have to separate the channels and process them one by
one.
Segmentation
The topic of image segmentation is a large one, which we have touched on in several places already, and
will return to in more sophisticated contexts later in the book as well. Here, we will focus on several
methods of the library that specifically implement techniques that are either segmentation methods in
themselves, or primitives that will be used later by more sophisticated tactics. It should be noted that at this
time, there is no general “magic” solution for image segmentation, and it remains a very active area in