In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "C++ OpenCV how to achieve histogram equalization", the content is simple and clear, I hope it can help you solve your doubts, now let the editor lead you to study and learn "C++ OpenCV how to achieve histogram equalization" this article.
Histogram definition
Because of its low computational cost and invariance of image translation, rotation and scaling, image histogram is widely used in various fields of image processing, especially in grayscale image threshold segmentation, color-based image retrieval and image classification.
In the digital age, histograms can be said to be everywhere. Whether it is the camera display screen, or later PS, ACR windows, and even color levels, curve tools, you can see the figure of the histogram.
To understand the histogram, you can't get around the concept of "brightness". The brightness of the photo is divided into 256 values from 0 to 255. The higher the value, the higher the brightness. Where 0 represents the darkest area of pure black, 255 represents the brightest pure white, and the number in the middle is gray of different brightness. These luminances are further divided into five areas, namely black, shadow, midtone, highlight and white.
If the pixels of an image occupy a lot of gray levels and are evenly distributed, then such images tend to have high contrast and variable grayscale tones. Histogram equalization is a kind of transformation function which can achieve this effect automatically only by inputting image histogram information. Its basic idea is to widen the gray level with a large number of pixels in the image, and to compress the gray level with a small number of pixels in the image, so as to expand the dynamic range of pixel values and improve the change of contrast and grayscale hue. Make the image clearer.
Basic thought
The "central idea" of histogram equalization is to change the gray histogram of the original image from a relatively concentrated gray range to a uniform distribution in the whole gray range. Histogram equalization is to stretch the image nonlinearly and redistribute the pixel value of the image so that the number of pixels in a certain gray range is roughly the same. Histogram equalization is to change the histogram distribution of a given image into a "uniform" histogram distribution.
The basic idea of histogram equalization is to transform the histogram of the original image into a uniformly distributed form, so as to increase the dynamic range of pixel gray values and enhance the overall contrast of the image.
Through the remapping of C++ OpenCV images in the previous article, we used the remap function to map the image gray distribution from one distribution to another, and then get the mapped pixel values.
Histogram equalization API cv::equalizeHist
Code demonstration
Create a new project opencv-0020, configure properties (VS2017 configure OpenCV common properties), and then write # include and main methods in the source file
Histogram equalization
The code is very simple.
Let's take a look at the display.
Let's try another picture and try the effect.
These are all the contents of this article entitled "how C++ OpenCV achieves histogram equalization". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.