47 : _input(nullptr), _pyramid(nullptr), _tmp()
54 : _horizontal_border_handler(),
55 _vertical_border_handler(),
56 _horizontal_reduction(),
78 const uint16_t pixel_value_u16 =
static_cast<uint16_t
>(constant_border_value) * 2 + static_cast<uint16_t>(constant_border_value) * 8 +
static_cast<uint16_t
>(constant_border_value) * 6;
88 _horizontal_border_handler.reserve(num_levels - 1);
89 _vertical_border_handler.reserve(num_levels - 1);
90 _horizontal_reduction.reserve(num_levels - 1);
91 _vertical_reduction.reserve(num_levels - 1);
98 _tmp.init(pyramid_info);
100 for(
size_t i = 0; i < num_levels - 1; ++i)
103 _horizontal_reduction.emplace_back(std::make_unique<CLGaussianPyramidHorKernel>());
104 _horizontal_reduction.back()->configure(compile_context, _pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i));
107 _vertical_reduction.emplace_back(std::make_unique<CLGaussianPyramidVertKernel>());
108 _vertical_reduction.back()->configure(compile_context, _tmp.get_pyramid_level(i), _pyramid->get_pyramid_level(i + 1));
111 _horizontal_border_handler.emplace_back(std::make_unique<CLFillBorderKernel>());
112 _horizontal_border_handler.back()->configure(compile_context, _pyramid->get_pyramid_level(i), _horizontal_reduction.back()->border_size(), border_mode,
PixelValue(constant_border_value));
115 _vertical_border_handler.emplace_back(std::make_unique<CLFillBorderKernel>());
116 _vertical_border_handler.back()->configure(compile_context, _tmp.get_pyramid_level(i), _vertical_reduction.back()->border_size(), border_mode,
PixelValue(pixel_value_u16));
127 const size_t num_levels = _pyramid->info()->num_levels();
132 _pyramid->get_pyramid_level(0)->copy_from(*_input);
137 for(
unsigned int i = 0; i < num_levels - 1; ++i)
174 _gauss5x5.resize(num_levels - 1);
175 _scale_nearest.reserve(num_levels - 1);
179 _tmp.
init(pyramid_info);
181 for(
size_t i = 0; i < num_levels - 1; ++i)
184 _gauss5x5[i].configure(compile_context, _pyramid->get_pyramid_level(i), _tmp.get_pyramid_level(i), border_mode, constant_border_value);
187 _scale_nearest.emplace_back(std::make_unique<CLScaleKernel>());
200 const size_t num_levels = _pyramid->info()->num_levels();
205 _pyramid->get_pyramid_level(0)->copy_from(*_input);
209 for(
unsigned int i = 0; i < num_levels - 1; ++i)
BorderMode
Methods available to handle borders.
constexpr float SCALE_PYRAMID_ORB
Constant value used to indicate a ORB scaled pyramid.
constexpr float SCALE_PYRAMID_HALF
Constant value used to indicate a half-scale pyramid.
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.
Class describing the value of a pixel for any image format.
void run() override
Run the kernels contained in the function.
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
static CLScheduler & get()
Access the scheduler singleton.
1 channel, 1 U8 per channel
const PyramidInfo * info() const override
Interface to be implemented by the child class to return the Pyramid's metadata.
void init(size_t num_levels, float scale, size_t width, size_t height, Format format)
Initialize pyramid's metadata for 2D tensors.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
1 channel, 1 U16 per channel
Output values are defined to match the source pixel whose center is nearest to the sample position...
Copyright (c) 2017-2021 Arm Limited.
Samples are taken at pixel center.
CLGaussianPyramidOrb()
Constructor.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
void configure(ICLTensor *input, CLPyramid *pyramid, BorderMode border_mode, uint8_t constant_border_value) override
Initialise the function's source, destinations and border mode.
size_t num_dimensions() const override
The number of dimensions of the tensor (rank)
Basic implementation of the OpenCL pyramid interface.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
float scale() const
Return the scale factor of the pyramid.
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Store the Pyramid's metadata.
CLGaussianPyramid()
Constructor.
CLGaussianPyramidHalf()
Constructor.
~CLGaussianPyramidHalf()
Default destructor.
void run() override
Run the kernels contained in the function.
Interface for OpenCL tensor.
CLTensor * get_pyramid_level(size_t index) const override
Retrieves a level of the pyramid as a ITensor pointer.
size_t width() const
Return the width of the 0th level tensor.
~CLGaussianPyramid()
Default destructor.
size_t num_levels() const
Return the number of the pyramid levels.
size_t height() const
Return the height of the 0th level tensor.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
void configure(ICLTensor *input, CLPyramid *pyramid, BorderMode border_mode, uint8_t constant_border_value) override
Initialise the function's source, destinations and border mode.