Histogram equalization of input image. More...

Functions

AFAPI array histequal (const array &in, const array &hist)
 C++ Interface for histogram equalization. More...
 
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 af::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.
Deprecated:
Use histEqual instead

◆ histEqual()

AFAPI array af::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.
Examples
image_processing/image_demo.cpp.
afcl::array
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
af::histogram
AFAPI array histogram(const array &in, const unsigned nbins, const double minval, const double maxval)
C++ Interface for histogram.
af::histEqual
AFAPI array histEqual(const array &in, const array &hist)
C++ Interface for histogram equalization.