Compute Library
 21.02
NEEqualizeHistogram Class Reference

Basic function to execute histogram equalization. More...

#include <NEEqualizeHistogram.h>

Collaboration diagram for NEEqualizeHistogram:
[legend]

Public Member Functions

 NEEqualizeHistogram ()
 Default Constructor. More...
 
 NEEqualizeHistogram (const NEEqualizeHistogram &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEEqualizeHistogramoperator= (const NEEqualizeHistogram &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEEqualizeHistogram (NEEqualizeHistogram &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
NEEqualizeHistogramoperator= (NEEqualizeHistogram &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NEEqualizeHistogram ()
 Default destructor. More...
 
void configure (const IImage *input, IImage *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 Neon kernels:

  1. NEHistogramKernel
  2. NECumulativeDistributionKernel
  3. NETableLookupKernel
Deprecated:
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 50 of file NEEqualizeHistogram.h.

Constructor & Destructor Documentation

◆ NEEqualizeHistogram() [1/3]

Default Constructor.

Definition at line 40 of file NEEqualizeHistogram.cpp.

References arm_compute::U8.

41  : _histogram_kernel(), _cd_histogram_kernel(), _map_histogram_kernel(), _hist(nr_bins, 0, max_range), _cum_dist(nr_bins, 0, max_range), _cd_lut(nr_bins, DataType::U8)
42 {
43 }
1 channel, 1 U8 per channel

◆ NEEqualizeHistogram() [2/3]

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEEqualizeHistogram() [3/3]

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ ~NEEqualizeHistogram()

~NEEqualizeHistogram ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( const IImage input,
IImage output 
)

Initialise the kernel's inputs.

Note
Currently the width of the input image must be a multiple of 16.
Parameters
[in]inputInput image. Data type supported: U8.
[out]outputOutput image. Data type supported: same as input

Definition at line 45 of file NEEqualizeHistogram.cpp.

References ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D, and arm_compute::U8.

46 {
51 
52  _histogram_kernel = std::make_unique<NEHistogramKernel>();
53  _cd_histogram_kernel = std::make_unique<NECumulativeDistributionKernel>();
54  _map_histogram_kernel = std::make_unique<NETableLookupKernel>();
55 
56  // Configure kernels
57  _histogram_kernel->configure(input, &_hist);
58  _cd_histogram_kernel->configure(input, &_hist, &_cum_dist, &_cd_lut);
59  _map_histogram_kernel->configure(input, &_cd_lut, output);
60 }
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
Definition: Validate.h:856
1 channel, 1 U8 per channel
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:790

◆ operator=() [1/2]

NEEqualizeHistogram& operator= ( const NEEqualizeHistogram )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

NEEqualizeHistogram& operator= ( NEEqualizeHistogram &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ 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 62 of file NEEqualizeHistogram.cpp.

References Window::DimY, Scheduler::get(), and IScheduler::schedule().

63 {
64  // Calculate histogram of input.
65  NEScheduler::get().schedule(_histogram_kernel.get(), Window::DimY);
66 
67  // Calculate cumulative distribution of histogram and create LUT.
68  NEScheduler::get().schedule(_cd_histogram_kernel.get(), Window::DimY);
69 
70  // Map input to output using created LUT.
71  NEScheduler::get().schedule(_map_histogram_kernel.get(), Window::DimY);
72 }
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Definition: Window.h:45
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94

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