Compute Library
 21.02
NEGaussianPyramidOrb Class Reference

Basic function to execute gaussian pyramid with ORB scale factor. More...

#include <NEGaussianPyramid.h>

Collaboration diagram for NEGaussianPyramidOrb:
[legend]

Public Member Functions

 NEGaussianPyramidOrb ()
 Constructor. More...
 
 NEGaussianPyramidOrb (const NEGaussianPyramidOrb &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEGaussianPyramidOrboperator= (const NEGaussianPyramidOrb &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEGaussianPyramidOrb (NEGaussianPyramidOrb &&)=default
 Allow instances of this class to be moved. More...
 
NEGaussianPyramidOrboperator= (NEGaussianPyramidOrb &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEGaussianPyramidOrb ()
 Default destructor. More...
 
void configure (const ITensor *input, IPyramid *pyramid, BorderMode border_mode, uint8_t constant_border_value) override
 Initialise the function's source, destinations and border mode. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from NEGaussianPyramid
 NEGaussianPyramid ()
 Default constructor. More...
 
 NEGaussianPyramid (const NEGaussianPyramid &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEGaussianPyramidoperator= (const NEGaussianPyramid &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEGaussianPyramid (NEGaussianPyramid &&)=default
 Allow instances of this class to be moved. More...
 
NEGaussianPyramidoperator= (NEGaussianPyramid &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~NEGaussianPyramid ()=default
 Default destructor. 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 gaussian pyramid with ORB scale factor.

This function calls the following Neon kernels and functions:

  1. NEFillBorderKernel (executed if border_mode == CONSTANT or border_mode == REPLICATE)
  2. NEGaussian5x5
  3. NEScaleKernel
Deprecated:
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 129 of file NEGaussianPyramid.h.

Constructor & Destructor Documentation

◆ NEGaussianPyramidOrb() [1/3]

Constructor.

Definition at line 141 of file NEGaussianPyramid.cpp.

142  : _gaus5x5(),
143  _scale_nearest()
144 {
145 }

◆ NEGaussianPyramidOrb() [2/3]

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

◆ NEGaussianPyramidOrb() [3/3]

Allow instances of this class to be moved.

◆ ~NEGaussianPyramidOrb()

~NEGaussianPyramidOrb ( )
default

Default destructor.

Referenced by NEGaussianPyramidHalf::run().

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
IPyramid pyramid,
BorderMode  border_mode,
uint8_t  constant_border_value 
)
overridevirtual

Initialise the function's source, destinations and border mode.

Parameters
[in]inputSource tensor. Data type supported: U8.
[out]pyramidDestination pyramid tensors, Data type supported at each level: U8.
[in]border_modeBorder mode to use.
[in]constant_border_value(Optional) Constant value to use for borders if border_mode is set to CONSTANT.

Implements NEGaussianPyramid.

Definition at line 147 of file NEGaussianPyramid.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, arm_compute::CENTER, ITensorInfo::dimension(), IPyramid::get_pyramid_level(), PyramidInfo::height(), ITensor::info(), IPyramid::info(), PyramidInfo::init(), arm_compute::test::validation::input, arm_compute::NEAREST_NEIGHBOR, ITensorInfo::num_dimensions(), PyramidInfo::num_levels(), PyramidInfo::scale(), arm_compute::SCALE_PYRAMID_ORB, PyramidInfo::tensor_shape(), arm_compute::U8, arm_compute::UNDEFINED, and PyramidInfo::width().

148 {
150  ARM_COMPUTE_ERROR_ON(nullptr == pyramid);
152  ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != pyramid->info()->width());
153  ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != pyramid->info()->height());
155 
156  /* Get number of pyramid levels */
157  const size_t num_levels = pyramid->info()->num_levels();
158  const size_t num_stages = num_levels - 1;
159 
160  _input = input;
161  _pyramid = pyramid;
162 
163  _gaus5x5.clear();
164  _scale_nearest.clear();
165 
166  _gaus5x5.resize(num_stages);
167  _scale_nearest.resize(num_stages);
168 
169  if(num_levels > 1)
170  {
171  PyramidInfo pyramid_info(num_levels - 1, SCALE_PYRAMID_ORB, pyramid->info()->tensor_shape(), Format::U8);
172  _tmp.init(pyramid_info);
173 
174  for(size_t i = 0; i < num_levels - 1; ++i)
175  {
176  /* Configure gaussian 5x5 */
177  _gaus5x5[i].configure(_pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
178 
179  /* Configure scale */
180  _scale_nearest[i].configure(_tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1), ScaleKernelInfo{ InterpolationPolicy::NEAREST_NEIGHBOR, BorderMode::UNDEFINED, PixelValue(), SamplingPolicy::CENTER, false });
181  }
182 
183  _tmp.allocate();
184  }
185 }
constexpr float SCALE_PYRAMID_ORB
Constant value used to indicate a ORB scaled pyramid.
Definition: Types.h:115
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
const TensorShape & tensor_shape() const
Return the TensorShape of the o-th level tensor.
Definition: PyramidInfo.cpp:92
Class describing the value of a pixel for any image format.
Definition: PixelValue.h:34
virtual const PyramidInfo * info() const =0
Interface to be implemented by the child class to return the Pyramid&#39;s metadata.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
1 channel, 1 U8 per channel
void init(size_t num_levels, float scale, size_t width, size_t height, Format format)
Initialize pyramid&#39;s metadata for 2D tensors.
Definition: PyramidInfo.cpp:50
#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
Output values are defined to match the source pixel whose center is nearest to the sample position...
Samples are taken at pixel center.
virtual ITensor * get_pyramid_level(size_t index) const =0
Retrieves a level of the pyramid as a ITensor pointer.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
float scale() const
Return the scale factor of the pyramid.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:790
Store the Pyramid&#39;s metadata.
Definition: PyramidInfo.h:35
Borders are left undefined.
size_t width() const
Return the width of the 0th level tensor.
Definition: PyramidInfo.cpp:82
size_t num_levels() const
Return the number of the pyramid levels.
Definition: PyramidInfo.cpp:77
size_t height() const
Return the height of the 0th level tensor.
Definition: PyramidInfo.cpp:87

◆ operator=() [1/2]

NEGaussianPyramidOrb& operator= ( const NEGaussianPyramidOrb )
delete

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

◆ operator=() [2/2]

NEGaussianPyramidOrb& operator= ( NEGaussianPyramidOrb &&  )
default

Allow instances of this class to be moved.

◆ 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 187 of file NEGaussianPyramid.cpp.

References ARM_COMPUTE_ERROR_ON_MSG.

188 {
189  ARM_COMPUTE_ERROR_ON_MSG(_pyramid == nullptr, "Unconfigured function");
190 
191  /* Get number of pyramid levels */
192  const size_t num_levels = _pyramid->info()->num_levels();
193 
194  /* The first level of the pyramid has the input image */
195  _pyramid->get_pyramid_level(0)->copy_from(*_input);
196 
197  for(unsigned int i = 0; i < num_levels - 1; ++i)
198  {
199  _gaus5x5[i].run();
200  _scale_nearest[i].run();
201  }
202 }
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

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