Compute Library
 21.02
CLEqualizeHistogram Class Reference

Basic function to execute histogram equalization. More...

#include <CLEqualizeHistogram.h>

Collaboration diagram for CLEqualizeHistogram:
[legend]

Public Member Functions

 CLEqualizeHistogram ()
 Default Constructor. More...
 
 CLEqualizeHistogram (const CLEqualizeHistogram &)=delete
 Prevent instances of this class from being copied. More...
 
CLEqualizeHistogramoperator= (const CLEqualizeHistogram &)=delete
 Prevent instances of this class from being copied. More...
 
 ~CLEqualizeHistogram ()
 Default destructor. More...
 
void configure (const ICLImage *input, ICLImage *output)
 Initialise the kernel's inputs. More...
 
void configure (const CLCompileContext &compile_context, const ICLImage *input, ICLImage *output)
 Initialise the kernel's inputs. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Detailed Description

Basic function to execute histogram equalization.

This function calls the following CL kernels:

  1. CLHistogramKernel
  2. CLTableLookupKernel
Deprecated:
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 51 of file CLEqualizeHistogram.h.

Constructor & Destructor Documentation

◆ CLEqualizeHistogram() [1/2]

Default Constructor.

Definition at line 87 of file CLEqualizeHistogram.cpp.

References arm_compute::U8, and CLEqualizeHistogram::~CLEqualizeHistogram().

88  : _histogram_kernel(std::make_unique<CLHistogramKernel>()),
89  _border_histogram_kernel(std::make_unique<CLHistogramBorderKernel>()),
90  _map_histogram_kernel(std::make_unique<CLTableLookupKernel>()),
91  _hist(nr_bins, 0, max_range),
92  _cum_dist(nr_bins, 0, max_range),
93  _cd_lut(nr_bins, DataType::U8)
94 {
95 }
1 channel, 1 U8 per channel

◆ CLEqualizeHistogram() [2/2]

Prevent instances of this class from being copied.

◆ ~CLEqualizeHistogram()

~CLEqualizeHistogram ( )
default

Default destructor.

Referenced by CLEqualizeHistogram::CLEqualizeHistogram().

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLImage input,
ICLImage output 
)

Initialise the kernel's inputs.

Parameters
[in]inputInput image. Data types supported: U8.
[out]outputOutput of same data type with equalized brightness and contrast.

Definition at line 99 of file CLEqualizeHistogram.cpp.

References CLKernelLibrary::get().

100 {
101  configure(CLKernelLibrary::get().get_compile_context(), input, output);
102 }
void configure(const ICLImage *input, ICLImage *output)
Initialise the kernel&#39;s inputs.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLImage input,
ICLImage output 
)

Initialise the kernel's inputs.

Parameters
[in]compile_contextThe compile context to be used.
[in]inputInput image. Data types supported: U8.
[out]outputOutput of same data type with equalized brightness and contrast.

Definition at line 104 of file CLEqualizeHistogram.cpp.

105 {
106  _histogram_kernel->configure(compile_context, input, &_hist);
107  _border_histogram_kernel->configure(compile_context, input, &_hist);
108  _map_histogram_kernel->configure(compile_context, input, &_cd_lut, output);
109 }

◆ operator=()

CLEqualizeHistogram& operator= ( const CLEqualizeHistogram )
delete

Prevent instances of this class from being copied.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 111 of file CLEqualizeHistogram.cpp.

References CLScheduler::enqueue(), and CLScheduler::get().

112 {
113  // Calculate histogram of input.
114  CLScheduler::get().enqueue(*_histogram_kernel, false);
115 
116  // Calculate remaining pixels when image is not multiple of the elements of histogram kernel
117  CLScheduler::get().enqueue(*_border_histogram_kernel, false);
118 
119  // Calculate cumulative distribution of histogram and create LUT.
120  calculate_cum_dist_and_lut(_hist, _cum_dist, _cd_lut);
121 
122  // Map input to output using created LUT.
123  CLScheduler::get().enqueue(*_map_histogram_kernel);
124 }
static CLScheduler & get()
Access the scheduler singleton.
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.

The documentation for this class was generated from the following files: