easy web maker

Image Enhancement & Filter

Brightness, Contrast, LUT

In this article, i'll introduce some basic ways of image enhancement, like brightness and contrast, then i will show serveral photographic filters. Most filters are designed by the method of LUT using RGB curves.

Brightness: The light of the image. We can discribe the brightness enhance by the equation Io = I + β, I is input image, and Io is output image, β is the parameter of brightness  intensity value. Below show the examples of brightness control in RGB color space and YCbCr color space .

RGB/C++/OpenCV
Mat src = imread(Filename);
Mat dst;
int beta = 30; //beta controls the brightness intensity. 
dst = src + Scalar(beta, beta, beta);

YCbCr/C++/OpenCV

int beta = 30; //beta controls the brightness intensity. 

Mat ycbImage; 

cv::cvtColor(src,ycbImage,COLOR_BGR2YCrCb); 

ycbImage.convertTo(ycbImage,CV_32F); 

 vector<Mat>channels(3); 

split(ycbImage,channels); 

channels[0] = channels[0] + beta;  

merge(channels,ycbImage);

Mobirise

Source image

Mobirise

Beta = 30

Mobirise

Beta = -30

Contrast: The scale of difference between brightest  and darkest. We can discribe the contrast by the equation Io = αI, I is input image, and Io is output image, α is the parameter of contrast intensity value. Below show the examples of brightness control in RGB color space and YCbCr color space .

RGB/C++/OpenCV
Mat src = imread(Filename);
Mat dst;
int alpha = 3; 
dst = alpha * src;

YCbCr/C++/OpenCV

int beta = 3; 

Mat ycbImage; 

cv::cvtColor(src,ycbImage,COLOR_BGR2YCrCb); 

ycbImage.convertTo(ycbImage,CV_32F); 

 vector<Mat>channels(3); 

split(ycbImage,channels); 

channels[0] = channels[0] * alpha;  

merge(channels,ycbImage);

Mobirise

Source image

Mobirise

alpha= 3

Mobirise

alpha = 0.5

LUT Filter: We use Look up Table to store the RGB values and modify them to new RGB values by changing the hue, saturation and brightness values. 

Step 1. Set the original-axis for mapping and the corresponding-axis for new RGB curve.

 float originalR[] = {0, 60, 110, 150, 235, 255};

float originalG[] = {0, 68, 105, 190, 255};

float originalB[] = {0, 88, 145, 185, 255}; 

float rCurve[] = {0, 102, 185, 220, 245, 245};

float gCurve[] = {0, 68, 120, 220, 255};

float bCurve[] = {0, 12, 140, 212, 255};

Step 2. Use LUT in OpenCV to store the original and corresponding axis by interpolation.

......

Mat lookUpTable(1, 256, CV_8U);

uchar* lut = lookUpTable.ptr(); 

interpolation(lut,fullRange,bCurve,originalB);

LUT(channels[0],lookUpTable,channels[0]); //LUT for Blue channel

interpolation(lut,fullRange,gCurve,originalG);

LUT(channels[1],lookUpTable,channels[1]);//LUT for Green channel 

interpolation(lut,fullRange,rCurve,originalR); 

LUT(channels[2],lookUpTable,channels[2]);//LUT for Red channel

.....

Mobirise

IG Moon filter

Mobirise

Warm filter

Mobirise

IG Clarendon Filter 

Mobirise

IG X-Pro II

Other Filter: We an also use other method to create our own filters, like edge detection, contours, etc. 

Mobirise

Neon lighting effect  based on contours 

Mobirise

Neon lighting effect based on contours  2

Mobirise

pencil effect based on edge detection

Top