43 : _memory_group(
std::move(memory_manager)),
49 _new_points_estimates(nullptr),
51 _new_points_internal(),
52 _old_points_internal(),
59 bool use_initial_estimate,
BorderMode border_mode, uint8_t constant_border_value)
73 _old_points = old_points;
74 _new_points = new_points;
75 _new_points_estimates = new_points_estimates;
77 const float pyr_scale = old_pyramid->
info()->
scale();
80 _kernel_tracker.clear();
84 _func_scharr.resize(_num_levels);
85 _kernel_tracker.resize(_num_levels);
86 _scharr_gx.resize(_num_levels);
87 _scharr_gy.resize(_num_levels);
93 for(
unsigned int i = 0; i < _num_levels; ++i)
100 const unsigned int width_ith = old_ith_input->
info()->
dimension(0);
101 const unsigned int height_ith = new_ith_input->
info()->
dimension(1);
105 _scharr_gx[i].allocator()->init(tensor_info);
106 _scharr_gy[i].allocator()->init(tensor_info);
109 _memory_group.
manage(&_scharr_gx[i]);
110 _memory_group.
manage(&_scharr_gy[i]);
113 _func_scharr[i].configure(old_ith_input, &_scharr_gx[i], &_scharr_gy[i], border_mode, constant_border_value);
116 _kernel_tracker[i] = std::make_unique<NELKTrackerKernel>();
117 _kernel_tracker[i]->configure(old_ith_input, new_ith_input, &_scharr_gx[i], &_scharr_gy[i],
118 old_points, new_points_estimates, new_points,
119 &_old_points_internal, &_new_points_internal,
120 termination, use_initial_estimate, epsilon, num_iterations, window_dimension,
121 i, _num_levels, pyr_scale);
123 _scharr_gx[i].allocator()->allocate();
124 _scharr_gy[i].allocator()->allocate();
137 _func_scharr[
level - 1].run();
BorderMode
Methods available to handle borders.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
Tensor * get_pyramid_level(size_t index) const override
Retrieves a level of the pyramid as a ITensor pointer.
void resize(size_t num)
Resizes the array to contain "num" elements.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Interface for Neon tensor.
Copyright (c) 2017-2021 Arm Limited.
Basic implementation of the pyramid interface.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
size_t num_values() const
Number of values currently stored in the array.
#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.
Termination
Termination criteria.
const PyramidInfo * info() const override
Interface to be implemented by the child class to return the Pyramid's metadata.
1 channel, 1 S16 per channel
Memory group resources scope handling class.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
NEOpticalFlow(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
void configure(const Pyramid *old_pyramid, const Pyramid *new_pyramid, const IKeyPointArray *old_points, const IKeyPointArray *new_points_estimates, IKeyPointArray *new_points, Termination termination, float epsilon, unsigned int num_iterations, size_t window_dimension, bool use_initial_estimate, BorderMode border_mode, uint8_t constant_border_value=0)
Initialise the function input and output.
Store the tensor's metadata.
size_t width() const
Return the width of the 0th level tensor.
size_t num_levels() const
Return the number of the pyramid levels.
size_t height() const
Return the height of the 0th level tensor.
Array< NELKInternalKeypoint > LKInternalKeypointArray
Array of LK Internel Keypoints.
~NEOpticalFlow()
Default destructor.
void run() override
Run the kernels contained in the function.
static IScheduler & get()
Access the scheduler singleton.