Showing posts with label Changing the contrast and brightness. Show all posts
Showing posts with label Changing the contrast and brightness. Show all posts

Thursday, November 14, 2019

[OpenCV Tutorial] $4 - Changing the contrast and brightness of an image!

Goal

In this tutorial you will learn how to:
  • Access pixel values
  • Initialize a matrix with zeros
  • Learn what cv::saturate_cast does and why it is useful
  • Get some cool info about pixel transformations

Theory

Image Processing

  • A general image processing operator is a function that takes one or more input images and produces an output image.
  • Image transforms can be seen as:
    • Point operators (pixel transforms)
    • Neighborhood (area-based) operators

Pixel Transforms

  • In this kind of image processing transform, each output pixel's value depends on only the corresponding input pixel value (plus, potentially, some globally collected information or parameters).
  • Examples of such operators include brightness and contrast adjustments as well as color correction and transformations.

Brightness and contrast adjustments

  • Two commonly used point processes are multiplication and addition with a constant:
    g(x)=αf(x)+β
  • The parameters α>0 and β are often called the gain and bias parameters; sometimes these parameters are said to control contrast and brightness respectively.
  • You can think of f(x) as the source image pixels and g(x) as the output image pixels. Then, more conveniently we can write the expression as:
    g(i,j)=αf(i,j)+β

    where i and j indicates that the pixel is located in the i-th row and j-th column.

Back to Top