Compute Library
 21.02
NEFillArrayKernel Class Reference

This kernel adds all texels greater than or equal to the threshold value to the keypoint array. More...

#include <NEFillArrayKernel.h>

Collaboration diagram for NEFillArrayKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEFillArrayKernel ()
 Default contructor. More...
 
 NEFillArrayKernel (const NEFillArrayKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEFillArrayKerneloperator= (const NEFillArrayKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEFillArrayKernel (NEFillArrayKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEFillArrayKerneloperator= (NEFillArrayKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEFillArrayKernel ()=default
 Default detructor. More...
 
void configure (const IImage *input, uint8_t threshold, IKeyPointArray *output)
 Initialise the kernel. More...
 
void run (const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
 
bool is_parallelisable () const override
 Indicates whether or not the kernel is parallelisable. More...
 
- Public Member Functions inherited from ICPPKernel
virtual ~ICPPKernel ()=default
 Default destructor. More...
 
virtual void run_nd (const Window &window, const ThreadInfo &info, const Window &thread_locator)
 legacy compatibility layer for implemantions which do not support thread_locator In these cases we simply narrow the interface down the legacy version More...
 
virtual void run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info)
 Execute the kernel on the passed window. More...
 
- Public Member Functions inherited from IKernel
 IKernel ()
 Constructor. More...
 
virtual ~IKernel ()=default
 Destructor. More...
 
virtual BorderSize border_size () const
 The size of the border for that kernel. More...
 
const Windowwindow () const
 The maximum window the kernel can be executed on. More...
 

Detailed Description

This kernel adds all texels greater than or equal to the threshold value to the keypoint array.

Definition at line 39 of file NEFillArrayKernel.h.

Constructor & Destructor Documentation

◆ NEFillArrayKernel() [1/3]

Default contructor.

Definition at line 35 of file NEFillArrayKernel.cpp.

Referenced by NEFillArrayKernel::name().

36  : _input(nullptr), _output(nullptr), _threshold(0)
37 {
38 }

◆ NEFillArrayKernel() [2/3]

NEFillArrayKernel ( const NEFillArrayKernel )
delete

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

◆ NEFillArrayKernel() [3/3]

Allow instances of this class to be moved.

◆ ~NEFillArrayKernel()

~NEFillArrayKernel ( )
default

Default detructor.

Referenced by NEFillArrayKernel::name().

Member Function Documentation

◆ configure()

void configure ( const IImage input,
uint8_t  threshold,
IKeyPointArray output 
)

Initialise the kernel.

Parameters
[in]inputSource image. Data type supported: U8.
[in]thresholdTexels greater than the threshold will be added to the array.
[out]outputArrays of keypoints to store the results.

Definition at line 40 of file NEFillArrayKernel.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D, arm_compute::calculate_max_window(), ITensor::info(), arm_compute::test::validation::input, num_elems_processed_per_iteration, arm_compute::test::validation::reference::threshold(), and arm_compute::U8.

Referenced by NEFillArrayKernel::name().

41 {
44  ARM_COMPUTE_ERROR_ON(nullptr == output);
45 
46  _input = input;
47  _output = output;
48  _threshold = threshold;
49 
50  constexpr unsigned int num_elems_processed_per_iteration = 1;
51 
52  // Configure kernel window
53  Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
54  INEKernel::configure(win);
55 }
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
Definition: Validate.h:856
1 channel, 1 U8 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
Class to describe a number of elements in each dimension.
Definition: Steps.h:40
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:790
unsigned int num_elems_processed_per_iteration
SimpleTensor< T > threshold(const SimpleTensor< T > &src, T threshold, T false_value, T true_value, ThresholdType type, T upper)
Definition: Threshold.cpp:35
Describe a multidimensional execution window.
Definition: Window.h:39

◆ is_parallelisable()

bool is_parallelisable ( ) const
overridevirtual

Indicates whether or not the kernel is parallelisable.

If the kernel is parallelisable then the window returned by window() can be split into sub-windows which can then be run in parallel.

If the kernel is not parallelisable then only the window returned by window() can be passed to run()

Returns
True if the kernel is parallelisable

Reimplemented from IKernel.

Definition at line 57 of file NEFillArrayKernel.cpp.

Referenced by NEFillArrayKernel::name().

58 {
59  return false;
60 }

◆ name()

◆ operator=() [1/2]

NEFillArrayKernel& operator= ( const NEFillArrayKernel )
delete

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

Referenced by NEFillArrayKernel::name().

◆ operator=() [2/2]

NEFillArrayKernel& operator= ( NEFillArrayKernel &&  )
default

Allow instances of this class to be moved.

◆ run()

void run ( const Window window,
const ThreadInfo info 
)
overridevirtual

Execute the kernel on the passed window.

Warning
If is_parallelisable() returns false then the passed window must be equal to window()
Note
The window has to be a region within the window returned by the window() method
The width of the window has to be a multiple of num_elems_processed_per_iteration().
Parameters
[in]windowRegion on which to execute the kernel. (Must be a region of the window returned by window())
[in]infoInfo about executing thread and CPU.

Reimplemented from ICPPKernel.

Definition at line 62 of file NEFillArrayKernel.cpp.

References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, arm_compute::execute_window_loop(), arm_compute::test::validation::input, and IKernel::window().

Referenced by NEFillArrayKernel::name().

63 {
64  ARM_COMPUTE_UNUSED(info);
67 
68  Iterator input(_input, window);
69 
70  execute_window_loop(window, [&](const Coordinates & id)
71  {
72  const uint8_t value = *input.ptr();
73 
74  if(value >= _threshold)
75  {
76  KeyPoint p;
77  p.x = id.x();
78  p.y = id.y();
79  p.strength = value;
80  p.tracking_status = 1;
81  p.scale = 0.f;
82  p.orientation = 0.f;
83  p.error = 0.f;
84 
85  if(!_output->push_back(p))
86  {
87  return; //Overflowed: stop trying to add more points
88  }
89  }
90  },
91  input);
92 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
float scale
Scale initialized to 0 by the corner detector.
Definition: Types.h:444
int32_t x
X coordinates.
Definition: Types.h:441
float orientation
Orientation initialized to 0 by the corner detector.
Definition: Types.h:445
int32_t tracking_status
Status initialized to 1 by the corner detector, set to 0 when the point is lost.
Definition: Types.h:446
Keypoint type.
Definition: Types.h:439
float strength
Strength of the point.
Definition: Types.h:443
float error
Tracking error initialized to 0 by the corner detector.
Definition: Types.h:447
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
Coordinates of an item.
Definition: Coordinates.h:37
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:941
int32_t y
Y coordinates.
Definition: Types.h:442
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77
bool push_back(const T &val)
Append the passed argument to the end of the array if there is room.
Definition: IArray.h:78
Iterator updated by execute_window_loop for each window element.
Definition: Helpers.h:46
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205

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