图像的象素值变换,包括亮度、对比度和GAMMA校正算法,环境是OPENCV4.0,VC6.0。算法参考了MATLAB函数 imadjust 。
//
// perform histgram equalization for single channel image
//
#include "cv.h"
#include "highgui.h"
/*
Reference for correspondent MATLAB function: imadjust
IMADJUST 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