blob: d7c31750c5ba568faad4548c7b4125b108b33439 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2016, 2017 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef __ARM_COMPUTE_NEFASTCORNERS_H__
25#define __ARM_COMPUTE_NEFASTCORNERS_H__
26
27#include "arm_compute/core/NEON/kernels/NEFastCornersKernel.h"
28#include "arm_compute/core/NEON/kernels/NEFillArrayKernel.h"
29#include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h"
30#include "arm_compute/core/NEON/kernels/NENonMaximaSuppression3x3Kernel.h"
31#include "arm_compute/core/Types.h"
32#include "arm_compute/runtime/Array.h"
33#include "arm_compute/runtime/IFunction.h"
34#include "arm_compute/runtime/Tensor.h"
35
36#include <cstdint>
37
38namespace arm_compute
39{
40class ITensor;
41using IImage = ITensor;
42
43/** Basic function to execute fast corners. This function call the following NEON kernels:
44 *
45 * -# @ref NEFastCornersKernel
46 * -# @ref NENonMaximaSuppression3x3Kernel (executed if nonmax_suppression == true)
47 * -# @ref NEFillArrayKernel
48 *
49 */
50class NEFastCorners : public IFunction
51{
52public:
53 /** Constructor */
54 NEFastCorners();
55 /** Initialize the function's source, destination, conv and border_mode.
56 *
57 * @param[in, out] input Source image. Data type supported: U8. (Written to only for @p border_mode != UNDEFINED)
58 * @param[in] threshold Threshold on difference between intensity of the central pixel and pixels on Bresenham's circle of radius 3.
59 * @param[in] nonmax_suppression If true, non-maximum suppression is applied to detected corners before being placed in the array.
60 * @param[out] corners Array of keypoints to store the results.
61 * @param[in] border_mode Strategy to use for borders.
62 * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT.
63 */
64 void configure(IImage *input, float threshold, bool nonmax_suppression, KeyPointArray *corners,
65 BorderMode border_mode, uint8_t constant_border_value = 0);
66
67 // Inherited methods overridden:
68 void run() override;
69
70private:
71 NEFastCornersKernel _fast_corners_kernel;
72 NEFillBorderKernel _border_handler;
73 NENonMaximaSuppression3x3Kernel _nonmax_kernel;
74 NEFillArrayKernel _fill_kernel;
75 Image _output;
76 Image _suppressed;
77 bool _non_max;
78};
79}
80#endif /*__ARM_COMPUTE_NEFASTCORNERS_H__ */