Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | ebcebf1 | 2020-10-21 00:04:14 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016-2020 Arm Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 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 | */ |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_NEFASTCORNERS_H |
| 25 | #define ARM_COMPUTE_NEFASTCORNERS_H |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 26 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 27 | #include "arm_compute/core/Types.h" |
| 28 | #include "arm_compute/runtime/Array.h" |
| 29 | #include "arm_compute/runtime/IFunction.h" |
Georgios Pinitas | d910ffa | 2017-09-18 16:04:42 +0100 | [diff] [blame] | 30 | #include "arm_compute/runtime/IMemoryManager.h" |
| 31 | #include "arm_compute/runtime/MemoryGroup.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 32 | #include "arm_compute/runtime/Tensor.h" |
| 33 | |
| 34 | #include <cstdint> |
Georgios Pinitas | d910ffa | 2017-09-18 16:04:42 +0100 | [diff] [blame] | 35 | #include <memory> |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 36 | |
| 37 | namespace arm_compute |
| 38 | { |
| 39 | class ITensor; |
Michalis Spyrou | ebcebf1 | 2020-10-21 00:04:14 +0100 | [diff] [blame] | 40 | class NENonMaximaSuppression3x3Kernel; |
| 41 | class NEFastCornersKernel; |
| 42 | class NEFillBorderKernel; |
| 43 | class NEFillArrayKernel; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 44 | using IImage = ITensor; |
| 45 | |
| 46 | /** Basic function to execute fast corners. This function call the following NEON kernels: |
| 47 | * |
| 48 | * -# @ref NEFastCornersKernel |
| 49 | * -# @ref NENonMaximaSuppression3x3Kernel (executed if nonmax_suppression == true) |
| 50 | * -# @ref NEFillArrayKernel |
| 51 | * |
morgolock | 0c86265 | 2020-11-06 08:59:45 +0000 | [diff] [blame] | 52 | * @deprecated This function is deprecated and is intended to be removed in 21.05 release |
| 53 | * |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 54 | */ |
| 55 | class NEFastCorners : public IFunction |
| 56 | { |
| 57 | public: |
| 58 | /** Constructor */ |
Georgios Pinitas | d910ffa | 2017-09-18 16:04:42 +0100 | [diff] [blame] | 59 | NEFastCorners(std::shared_ptr<IMemoryManager> memory_manager = nullptr); |
Michalis Spyrou | ebcebf1 | 2020-10-21 00:04:14 +0100 | [diff] [blame] | 60 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 61 | NEFastCorners(const NEFastCorners &) = delete; |
| 62 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 63 | NEFastCorners &operator=(const NEFastCorners &) = delete; |
| 64 | /** Prevent instances of this class from being moved (As this class contains non movable objects) */ |
| 65 | NEFastCorners(NEFastCorners &&) = delete; |
| 66 | /** Prevent instances of this class from being moved (As this class contains non movable objects) */ |
| 67 | NEFastCorners &operator=(NEFastCorners &&) = delete; |
| 68 | /** Default destructor */ |
| 69 | ~NEFastCorners(); |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 70 | /** Initialize the function's source, destination, conv and border_mode. |
| 71 | * |
| 72 | * @param[in, out] input Source image. Data type supported: U8. (Written to only for @p border_mode != UNDEFINED) |
| 73 | * @param[in] threshold Threshold on difference between intensity of the central pixel and pixels on Bresenham's circle of radius 3. |
| 74 | * @param[in] nonmax_suppression If true, non-maximum suppression is applied to detected corners before being placed in the array. |
| 75 | * @param[out] corners Array of keypoints to store the results. |
| 76 | * @param[in] border_mode Strategy to use for borders. |
| 77 | * @param[in] constant_border_value (Optional) Constant value to use for borders if border_mode is set to CONSTANT. |
| 78 | */ |
| 79 | void configure(IImage *input, float threshold, bool nonmax_suppression, KeyPointArray *corners, |
| 80 | BorderMode border_mode, uint8_t constant_border_value = 0); |
| 81 | |
| 82 | // Inherited methods overridden: |
| 83 | void run() override; |
| 84 | |
| 85 | private: |
Michalis Spyrou | ebcebf1 | 2020-10-21 00:04:14 +0100 | [diff] [blame] | 86 | MemoryGroup _memory_group; |
| 87 | std::unique_ptr<NEFastCornersKernel> _fast_corners_kernel; |
| 88 | std::unique_ptr<NEFillBorderKernel> _border_handler; |
| 89 | std::unique_ptr<NENonMaximaSuppression3x3Kernel> _nonmax_kernel; |
| 90 | std::unique_ptr<NEFillArrayKernel> _fill_kernel; |
| 91 | Image _output; |
| 92 | Image _suppressed; |
| 93 | bool _non_max; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 94 | }; |
| 95 | } |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 96 | #endif /*ARM_COMPUTE_NEFASTCORNERS_H */ |