The pixel value of the image, including brightness, contrast, and GAMMA correction algorithm, the environment is OpenCv4.0, VC6.0. The algorithm references the MATLAB function imadjust. /// perform histgram equalization for single channel image //
#include "cv.h" #include "highgui.h"
/ * Reference for correspondent MATLAB function: imadjustIMADJUST Adjust image intensity values or colormap J = IMADJUST (I, [LOW_IN HIGH_IN], [LOW_OUT HIGH_OUT], GAMMA) maps the values in intensity image I to new values in J such that values between. LOW_IN and HIGH_IN map to values between LOW_OUT and HIGH_OUT values below LOW_IN and above HIGH_IN are clipped;. that is, values below LOW_IN map to LOW_OUT, and those above HIGH_IN map to HIGH_OUT You can use an empty matrix ([]) for [. LOW_IN HIGH_IN] or for [LOW_OUT HIGH_OUT] to specify the default of [0 1]. GAMMA specifies the shape of the curve describing the relationship between the values in I and J. If GAMMA is less than 1, the mapping is weighted toward higher (brighter) Output Values. IF Gamma Is Greater Than 1, The Mapping IS Weighted Tower (DARKER) Output Values. If You Omit The Argument, Gamma Defaults To 1 (Linear Mapping).
Note That if high_out IF (Low <0 &&ow> 1 && Bottom <0 && Bottom> 1 && Top <0 && TOP> 1) Return 1; // Intensity Transform for (Y = 0; Y