41 : _memory_group(
std::move(memory_manager)),
49 _num_corners(nullptr),
52 _constant_border_value(0)
59 unsigned int *num_corners,
BorderMode border_mode, uint8_t constant_border_value)
61 configure(
CLKernelLibrary::get().get_compile_context(), input, threshold, nonmax_suppression, corners, num_corners, border_mode, constant_border_value);
65 unsigned int *num_corners,
BorderMode border_mode, uint8_t constant_border_value)
75 _non_max = nonmax_suppression;
76 _num_corners = num_corners;
78 _num_buffer = cl::Buffer(
CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE,
sizeof(
unsigned int));
79 _constant_border_value = constant_border_value;
81 const bool update_number = (
nullptr != _num_corners);
83 _memory_group.
manage(&_output);
84 _fast_corners_kernel->configure(compile_context, input, &_output, threshold, nonmax_suppression, border_mode);
88 _copy_array_kernel->configure(compile_context, &_output, update_number, _corners, &_num_buffer);
93 _memory_group.
manage(&_suppr);
95 _suppr_func.
configure(compile_context, &_output, &_suppr, border_mode);
96 _copy_array_kernel->configure(compile_context, &_suppr, update_number, _corners, &_num_buffer);
114 const auto out_buffer =
static_cast<unsigned char *
>(q.enqueueMapBuffer(_output.
cl_buffer(), CL_TRUE, CL_MAP_WRITE, 0, _output.
info()->
total_size()));
116 q.enqueueUnmapMemObject(_output.
cl_buffer(), out_buffer);
128 unsigned int get_num_corners = 0;
129 q.enqueueReadBuffer(_num_buffer, CL_TRUE, 0,
sizeof(
unsigned int), &get_num_corners);
131 size_t corner_size = std::min(static_cast<size_t>(get_num_corners), _corners->
max_num_values());
133 _corners->
resize(corner_size);
135 if(_num_corners !=
nullptr)
137 *_num_corners = get_num_corners;
BorderMode
Methods available to handle borders.
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
static CLScheduler & get()
Access the scheduler singleton.
void run() override
Run the kernels contained in the function.
const cl::Buffer & cl_buffer() const override
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing ...
1 channel, 1 U8 per channel
void resize(size_t num)
Resizes the array to contain "num" elements.
CLFastCorners(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
CL kernel to perform fast corners.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
CLTensorAllocator * allocator()
Return a pointer to the tensor's allocator.
void init(const TensorInfo &input, size_t alignment=0)
Initialize a tensor based on the passed TensorInfo.
Copyright (c) 2017-2021 Arm Limited.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
Interface for OpenCL Array.
void run() override final
Run the kernels contained in the function.
void configure(ICLTensor *input, ICLTensor *output, BorderMode border_mode)
Initialise the function's source, destinations and border mode.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
size_t total_size() const override
Returns the total size of the tensor in bytes.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
cl::CommandQueue & queue()
Accessor for the associated CL command queue.
CL kernel to copy keypoints information to ICLKeyPointArray and counts the number of key points...
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
void configure(const ICLImage *input, float threshold, bool nonmax_suppression, ICLKeyPointArray *corners, unsigned int *num_corners, BorderMode border_mode, uint8_t constant_border_value=0)
Initialize the function's source, destination, conv and border_mode.
Memory group resources scope handling class.
Interface for OpenCL tensor.
~CLFastCorners()
Default destructor.
Borders are left undefined.
Wrapper to configure the Khronos OpenCL C++ header.
size_t max_num_values() const
Maximum number of values which can be stored in this array.
Store the tensor's metadata.
SimpleTensor< T > threshold(const SimpleTensor< T > &src, T threshold, T false_value, T true_value, ThresholdType type, T upper)