47 : _memory_group(
std::move(memory_manager)),
60 _num_corner_candidates(0),
68 float sensitivity, int32_t gradient_size, int32_t block_size,
ICLKeyPointArray *corners,
69 BorderMode border_mode, uint8_t constant_border_value,
bool use_fp16)
71 configure(
CLKernelLibrary::get().get_compile_context(), input, threshold, min_dist, sensitivity, gradient_size, block_size, corners, border_mode, constant_border_value, use_fp16);
75 float sensitivity, int32_t gradient_size, int32_t block_size,
ICLKeyPointArray *corners,
76 BorderMode border_mode, uint8_t constant_border_value,
bool use_fp16)
97 _corners_list.resize(shape.
x() * shape.
y());
100 _memory_group.
manage(&_gx);
101 _memory_group.
manage(&_gy);
104 switch(gradient_size)
108 auto k = std::make_unique<CLSobel3x3>();
109 k->configure(compile_context, input, &_gx, &_gy, border_mode, constant_border_value);
110 _sobel = std::move(k);
115 auto k = std::make_unique<CLSobel5x5>();
116 k->configure(compile_context, input, &_gx, &_gy, border_mode, constant_border_value);
117 _sobel = std::move(k);
122 auto k = std::make_unique<CLSobel7x7>();
123 k->configure(compile_context, input, &_gx, &_gy, border_mode, constant_border_value);
124 _sobel = std::move(k);
132 const float norm_factor = 1.0f / (255.0f * pow(4.0f, gradient_size / 2) * block_size);
133 const float pow4_normalization_factor = pow(norm_factor, 4);
136 _memory_group.
manage(&_score);
139 _harris_score->configure(compile_context, &_gx, &_gy, &_score, block_size, pow4_normalization_factor, threshold, sensitivity, border_mode ==
BorderMode::UNDEFINED);
142 _border_gx->configure(compile_context, &_gx, _harris_score->border_size(), border_mode,
PixelValue(constant_border_value));
143 _border_gy->configure(compile_context, &_gy, _harris_score->border_size(), border_mode,
PixelValue(constant_border_value));
150 _memory_group.
manage(&_nonmax);
153 _non_max_suppr.
configure(compile_context, &_score, &_nonmax, border_mode);
159 _candidates.
configure(&_nonmax, _corners_list.data(), &_num_corner_candidates);
165 _sort_euclidean.
configure(_corners_list.data(), _corners, &_num_corner_candidates, min_dist);
175 _num_corner_candidates = 0;
188 _non_max_suppr.
run();
BorderMode
Methods available to handle borders.
Class describing the value of a pixel for any image format.
~CLHarrisCorners()
Default destructor.
#define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t)
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
1 channel, 1 U8 per channel
1 channel, 1 F32 per channel
void map(cl::CommandQueue &q, bool blocking=true)
Enqueue a map operation of the allocated buffer on the given queue.
#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.
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 map(bool blocking=true)
Enqueue a map operation of the allocated buffer.
1 channel, 1 S32 per channel
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
T x() const
Alias to access the size of the first dimension.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
void configure(InternalKeypoint *in_out, IKeyPointArray *output, const int32_t *num_corner_candidates, float min_distance)
Initialise the kernel's source, destination and border mode.
Interface for OpenCL Array.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
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)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Interface for the harris score kernel.
1 channel, 1 S16 per channel
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,...)
void unmap(cl::CommandQueue &q)
Enqueue an unmap operation of the allocated and mapped buffer on the given queue. ...
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Interface for filling the border of a kernel.
Memory group resources scope handling class.
Interface for OpenCL tensor.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
Borders are left undefined.
void run() override
Run the kernels contained in the function.
Wrapper to configure the Khronos OpenCL C++ header.
Store the tensor's metadata.
T y() const
Alias to access the size of the second dimension.
void configure(ICLImage *input, float threshold, float min_dist, float sensitivity, int32_t gradient_size, int32_t block_size, ICLKeyPointArray *corners, BorderMode border_mode, uint8_t constant_border_value=0, bool use_fp16=false)
Initialize the function's source, destination, conv and border_mode.
DataType
Available data types.
void unmap()
Enqueue an unmap operation of the allocated and mapped buffer.
SimpleTensor< T > threshold(const SimpleTensor< T > &src, T threshold, T false_value, T true_value, ThresholdType type, T upper)
CLHarrisCorners(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
void configure(const IImage *input, InternalKeypoint *output, int32_t *num_corner_candidates)
Setup the kernel parameters.
static IScheduler & get()
Access the scheduler singleton.