A high-performance general-purpose compute library

Histogram equalization of input image. More...

Functions

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

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]outis an array with data that has histogram approximately equal to histogram
[in]inis the input array, non-normalized input (!! assumes values [0-255] !!)
[in]histtarget 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 }
AFAPI array histEqual(const array &in, const array &hist)
C++ Interface for histogram equalization.
AFAPI array histogram(const array &in, const unsigned nbins, const double minval, const double maxval)
C++ Interface for histogram.
Parameters
[in]inis the input array, non-normalized input (!! assumes values [0-255] !!)
[in]histtarget 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

◆ 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]inis the input array, non-normalized input (!! assumes values [0-255] !!)
[in]histtarget histogram to approximate in output (based on number of bins)
Returns
data with histogram approximately equal to histogram
Note
in must be two dimensional.