Compute Library
 19.08
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...
 
- 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 34 of file NEFillArrayKernel.cpp.

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

◆ 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.

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 39 of file NEFillArrayKernel.cpp.

40 {
43  ARM_COMPUTE_ERROR_ON(nullptr == output);
44 
45  _input = input;
46  _output = output;
47  _threshold = threshold;
48 
49  constexpr unsigned int num_elems_processed_per_iteration = 1;
50  constexpr unsigned int num_elems_read_per_iteration = 1;
51 
52  // Configure kernel window
53  Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
54 
55  update_window_and_padding(win, AccessWindowHorizontal(input->info(), 0, num_elems_read_per_iteration));
56 
57  INEKernel::configure(win);
58 }
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:337
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps=Steps(), bool skip_border=false, BorderSize border_size=BorderSize())
Calculate the maximum window for a given tensor shape and border setting.
Definition: Helpers.cpp:28
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
Definition: Validate.h:855
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
Definition: Helpers.h:402
Class to describe a number of elements in each dimension.
Definition: Steps.h:40
Implementation of a row access pattern.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:789
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

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::reference::threshold(), arm_compute::U8, and arm_compute::update_window_and_padding().

Referenced by NEFastCorners::configure().

◆ 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 60 of file NEFillArrayKernel.cpp.

61 {
62  return false;
63 }

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 42 of file NEFillArrayKernel.h.

43  {
44  return "NEFillArrayKernel";
45  }

◆ operator=() [1/2]

NEFillArrayKernel& operator= ( const NEFillArrayKernel )
delete

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

◆ 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.

Implements ICPPKernel.

Definition at line 65 of file NEFillArrayKernel.cpp.

66 {
70 
71  Iterator input(_input, window);
72 
73  execute_window_loop(window, [&](const Coordinates & id)
74  {
75  const uint8_t value = *input.ptr();
76 
77  if(value >= _threshold)
78  {
79  KeyPoint p;
80  p.x = id.x();
81  p.y = id.y();
82  p.strength = value;
83  p.tracking_status = 1;
84  p.scale = 0.f;
85  p.orientation = 0.f;
86  p.error = 0.f;
87 
88  if(!_output->push_back(p))
89  {
90  return; //Overflowed: stop trying to add more points
91  }
92  }
93  },
94  input);
95 }
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:408
int32_t x
X coordinates.
Definition: Types.h:405
float orientation
Orientation initialized to 0 by the corner detector.
Definition: Types.h:409
int32_t tracking_status
Status initialized to 1 by the corner detector, set to 0 when the point is lost.
Definition: Types.h:410
Keypoint type.
Definition: Types.h:403
float strength
Strength of the point.
Definition: Types.h:407
float error
Tracking error initialized to 0 by the corner detector.
Definition: Types.h:411
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160
Coordinates of an item.
Definition: Coordinates.h:37
int32_t y
Y coordinates.
Definition: Types.h:406
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:122
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:318
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:940

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::info, and IKernel::window().


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