| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Functions
The module brings implementations of intensity transformation algorithms to adjust image contrast.

## Detailed Description

Namespace for all functions is `cv::intensity_transform`.

### Supported Algorithms

- Autoscaling
- Log Transformations
- Power-Law (Gamma) Transformations
- Contrast Stretching
- BIMEF, A Bio-Inspired Multi-Exposure Fusion Framework for Low-light Image Enhancement [311] [312]

References from following book and websites:

- Digital Image Processing 4th Edition Chapter 3 [Rafael C. Gonzalez, Richard E. Woods] [223]
- http://www.cs.uregina.ca/Links/class-info/425/Lab3/ [154]
- https://theailearner.com/2019/01/30/contrast-stretching/ [270]

## Functions
void | cv::intensity_transform::autoscaling (const Mat input, Mat &output)
| Given an input bgr or grayscale image, apply autoscaling on domain [0, 255] to increase the contrast of the input image and return the resulting image.
void | cv::intensity_transform::BIMEF (InputArray input, OutputArray output, float k, float mu, float a, float b)
| Given an input color image, enhance low-light images using the BIMEF method ([311] [312]).
void | cv::intensity_transform::BIMEF (InputArray input, OutputArray output, float mu=0.5f, float a=-0.3293f, float b=1.1258f)
| Given an input color image, enhance low-light images using the BIMEF method ([311] [312]).
void | cv::intensity_transform::contrastStretching (const Mat input, Mat &output, const int r1, const int s1, const int r2, const int s2)
| Given an input bgr or grayscale image, apply linear contrast stretching on domain [0, 255] and return the resulting image.
void | cv::intensity_transform::gammaCorrection (const Mat input, Mat &output, const float gamma)
| Given an input bgr or grayscale image and constant gamma, apply power-law transformation, a.k.a. gamma correction to the image on domain [0, 255] and return the resulting image.
void | cv::intensity_transform::logTransform (const Mat input, Mat &output)
| Given an input bgr or grayscale image and constant c, apply log transformation to the image on domain [0, 255] and return the resulting image.

## Function Documentation

## ◆ autoscaling()

void cv::intensity_transform::autoscaling | ( | const Mat | input,
|  | Mat & | output )

Python:
| cv.intensity_transform.autoscaling( | input, output | ) -> | None

`#include <opencv2/intensity_transform.hpp>`

Given an input bgr or grayscale image, apply autoscaling on domain [0, 255] to increase the contrast of the input image and return the resulting image.

Parameters

  input | input bgr or grayscale image.
  output | resulting image of autoscaling.

## ◆ BIMEF() [1/2]

void cv::intensity_transform::BIMEF | ( | InputArray | input,
|  | OutputArray | output,
|  | float | k,
|  | float | mu,
|  | float | a,
|  | float | b )

Python:
| cv.intensity_transform.BIMEF( | input[, output[, mu[, a[, b]]]] | ) -> | output
| cv.intensity_transform.BIMEF2( | input, k, mu, a, b[, output] | ) -> | output

`#include <opencv2/intensity_transform.hpp>`

Given an input color image, enhance low-light images using the BIMEF method ([311] [312]).

This is an overloaded function with the exposure ratio given as parameter.

Parameters

  input | input color image.
  output | resulting image.
  k | exposure ratio.
  mu | enhancement ratio.
  a | a-parameter in the Camera Response Function (CRF).
  b | b-parameter in the Camera Response Function (CRF).

Warning
  This is a C++ implementation of the original MATLAB algorithm. Compared to the original code, this implementation is a little bit slower and does not provide the same results. In particular, quality of the image enhancement is degraded for the bright areas in certain conditions.

## ◆ BIMEF() [2/2]

void cv::intensity_transform::BIMEF | ( | InputArray | input,
|  | OutputArray | output,
|  | float | mu = 0.5f,
|  | float | a = -0.3293f,
|  | float | b = 1.1258f )

Python:
| cv.intensity_transform.BIMEF( | input[, output[, mu[, a[, b]]]] | ) -> | output
| cv.intensity_transform.BIMEF2( | input, k, mu, a, b[, output] | ) -> | output

`#include <opencv2/intensity_transform.hpp>`

Given an input color image, enhance low-light images using the BIMEF method ([311] [312]).

Parameters

  input | input color image.
  output | resulting image.
  mu | enhancement ratio.
  a | a-parameter in the Camera Response Function (CRF).
  b | b-parameter in the Camera Response Function (CRF).

Warning
  This is a C++ implementation of the original MATLAB algorithm. Compared to the original code, this implementation is a little bit slower and does not provide the same results. In particular, quality of the image enhancement is degraded for the bright areas in certain conditions.

## ◆ contrastStretching()

void cv::intensity_transform::contrastStretching | ( | const Mat | input,
|  | Mat & | output,
|  | const int | r1,
|  | const int | s1,
|  | const int | r2,
|  | const int | s2 )

Python:
| cv.intensity_transform.contrastStretching( | input, output, r1, s1, r2, s2 | ) -> | None

`#include <opencv2/intensity_transform.hpp>`

Given an input bgr or grayscale image, apply linear contrast stretching on domain [0, 255] and return the resulting image.

Parameters

  input | input bgr or grayscale image.
  output | resulting image of contrast stretching.
  r1 | x coordinate of first point (r1, s1) in the transformation function.
  s1 | y coordinate of first point (r1, s1) in the transformation function.
  r2 | x coordinate of second point (r2, s2) in the transformation function.
  s2 | y coordinate of second point (r2, s2) in the transformation function.

## ◆ gammaCorrection()

void cv::intensity_transform::gammaCorrection | ( | const Mat | input,
|  | Mat & | output,
|  | const float | gamma )

Python:
| cv.intensity_transform.gammaCorrection( | input, output, gamma | ) -> | None

`#include <opencv2/intensity_transform.hpp>`

Given an input bgr or grayscale image and constant gamma, apply power-law transformation, a.k.a. gamma correction to the image on domain [0, 255] and return the resulting image.

Parameters

  input | input bgr or grayscale image.
  output | resulting image of gamma corrections.
  gamma | constant in c*r^gamma where r is pixel value.

## ◆ logTransform()

void cv::intensity_transform::logTransform | ( | const Mat | input,
|  | Mat & | output )

Python:
| cv.intensity_transform.logTransform( | input, output | ) -> | None

`#include <opencv2/intensity_transform.hpp>`

Given an input bgr or grayscale image and constant c, apply log transformation to the image on domain [0, 255] and return the resulting image.

Parameters

  input | input bgr or grayscale image.
  output | resulting image of log transformations.