A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
histequal
ArrayFire Functions | ArrayFire Functions by Category » Image Processing » Histograms

Histogram equalization of input image More...

## Functions
AFAPI array | histequal (const array &in, const array &hist)
| C++ Interface for histogram equalization.
AFAPI array | histEqual (const array &in, const array &hist)
| C++ Interface for histogram equalization.
AFAPI af_err | af_hist_equal (af_array *out, const af_array in, const af_array hist)
| C Interface for histogram equalization.

## Detailed Description

Histogram equalization of input image

Histogram equalization is a method in image processing of contrast adjustment using the image's histogram.

Data normalization via histogram equalization

## Function Documentation

## ◆ af_hist_equal()

AFAPI af_err af_hist_equal | ( | af_array * | out,
|  | const af_array | in,
|  | const af_array | hist )

C Interface for histogram equalization.

Parameters

  [out] | out | is an array with data that has histogram approximately equal to histogram
  [in] | in | is the input array, non-normalized input (!! assumes values [0-255] !!)
  [in] | hist | target histogram to approximate in output (based on number of bins)

Returns
  AF_SUCCESS if the color transformation is successful, otherwise an appropriate error code is returned.

Note
  `in` must be two dimensional.

## ◆ histEqual()

AFAPI array histEqual | ( | const array & | in,
|  | const array & | hist )

C++ Interface for histogram equalization.

float input[] = {1, 2, 1, 1, 3, 6, 7, 8, 3};
int nbins = 10;
size_t nElems = sizeof(input) / sizeof(float);
array hist_in(nElems, input);
array hist_out = histogram(hist_in, nbins);
// input after histogram equalization or normalization
// based on histogram provided
array eq_out = histEqual(hist_in, hist_out);
// eq_out = { 1.5, 4.5, 1.5, 1.5, 4.5, 4.5, 6.0, 7.5, 4.5 }

Parameters

  [in] | in | is the input array, non-normalized input (!! assumes values [0-255] !!)
  [in] | hist | target histogram to approximate in output (based on number of bins)

Returns
  data with histogram approximately equal to histogram

Note
  `in` must be two dimensional.

## ◆ histequal()

AFAPI array histequal | ( | const array & | in,
|  | const array & | hist )

C++ Interface for histogram equalization.

float input[] = {1, 2, 1, 1, 3, 6, 7, 8, 3};
int nbins = 10;
size_t nElems = sizeof(input) / sizeof(float);
array hist_in(nElems, input);
array hist_out = histogram(hist_in, nbins);
// input after histogram equalization or normalization
// based on histogram provided
array eq_out = histEqual(hist_in, hist_out);
// eq_out = { 1.5, 4.5, 1.5, 1.5, 4.5, 4.5, 6.0, 7.5, 4.5 }

Parameters

  [in] | in | is the input array, non-normalized input (!! assumes values [0-255] !!)
  [in] | hist | target histogram to approximate in output (based on number of bins)

Returns
  data with histogram approximately equal to histogram

Note
  `in` must be two dimensional.

Deprecated
  Use histEqual instead