Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/features2d/src/hal_replacement.hpp
16337 views
1
/*M///////////////////////////////////////////////////////////////////////////////////////
2
//
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
//
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
8
//
9
//
10
// License Agreement
11
// For Open Source Computer Vision Library
12
//
13
// Copyright (C) 2017, Intel Corporation, all rights reserved.
14
// Third party copyrights are property of their respective owners.
15
//
16
// Redistribution and use in source and binary forms, with or without modification,
17
// are permitted provided that the following conditions are met:
18
//
19
// * Redistribution's of source code must retain the above copyright notice,
20
// this list of conditions and the following disclaimer.
21
//
22
// * Redistribution's in binary form must reproduce the above copyright notice,
23
// this list of conditions and the following disclaimer in the documentation
24
// and/or other materials provided with the distribution.
25
//
26
// * The name of the copyright holders may not be used to endorse or promote products
27
// derived from this software without specific prior written permission.
28
//
29
// This software is provided by the copyright holders and contributors "as is" and
30
// any express or implied warranties, including, but not limited to, the implied
31
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32
// In no event shall the Intel Corporation or contributors be liable for any direct,
33
// indirect, incidental, special, exemplary, or consequential damages
34
// (including, but not limited to, procurement of substitute goods or services;
35
// loss of use, data, or profits; or business interruption) however caused
36
// and on any theory of liability, whether in contract, strict liability,
37
// or tort (including negligence or otherwise) arising in any way out of
38
// the use of this software, even if advised of the possibility of such damage.
39
//
40
//M*/
41
42
#ifndef OPENCV_FEATURES2D_HAL_REPLACEMENT_HPP
43
#define OPENCV_FEATURES2D_HAL_REPLACEMENT_HPP
44
45
#include "opencv2/core/hal/interface.h"
46
47
#if defined __GNUC__
48
# pragma GCC diagnostic push
49
# pragma GCC diagnostic ignored "-Wunused-parameter"
50
#elif defined _MSC_VER
51
# pragma warning( push )
52
# pragma warning( disable: 4100 )
53
#endif
54
55
//! @addtogroup features2d_hal_interface
56
//! @note Define your functions to override default implementations:
57
//! @code
58
//! #undef hal_add8u
59
//! #define hal_add8u my_add8u
60
//! @endcode
61
//! @{
62
/**
63
@brief Detects corners using the FAST algorithm, returns mask.
64
@param src_data,src_step Source image
65
@param dst_data,dst_step Destination mask
66
@param width,height Source image dimensions
67
@param type FAST type
68
*/
69
inline int hal_ni_FAST_dense(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, cv::FastFeatureDetector::DetectorType type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
70
71
//! @cond IGNORED
72
#define cv_hal_FAST_dense hal_ni_FAST_dense
73
//! @endcond
74
75
/**
76
@brief Non-maximum suppression for FAST_9_16.
77
@param src_data,src_step Source mask
78
@param dst_data,dst_step Destination mask after NMS
79
@param width,height Source mask dimensions
80
*/
81
inline int hal_ni_FAST_NMS(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
82
83
//! @cond IGNORED
84
#define cv_hal_FAST_NMS hal_ni_FAST_NMS
85
//! @endcond
86
87
/**
88
@brief Detects corners using the FAST algorithm.
89
@param src_data,src_step Source image
90
@param width,height Source image dimensions
91
@param keypoints_data Pointer to keypoints
92
@param keypoints_count Count of keypoints
93
@param threshold Threshold for keypoint
94
@param nonmax_suppression Indicates if make nonmaxima suppression or not.
95
@param type FAST type
96
*/
97
inline int hal_ni_FAST(const uchar* src_data, size_t src_step, int width, int height, uchar* keypoints_data, size_t* keypoints_count, int threshold, bool nonmax_suppression, int /*cv::FastFeatureDetector::DetectorType*/ type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
98
99
//! @cond IGNORED
100
#define cv_hal_FAST hal_ni_FAST
101
//! @endcond
102
103
//! @}
104
105
106
#if defined __GNUC__
107
# pragma GCC diagnostic pop
108
#elif defined _MSC_VER
109
# pragma warning( pop )
110
#endif
111
112
#include "custom_hal.hpp"
113
114
//! @cond IGNORED
115
#define CALL_HAL_RET(name, fun, retval, ...) \
116
int res = __CV_EXPAND(fun(__VA_ARGS__, &retval)); \
117
if (res == CV_HAL_ERROR_OK) \
118
return retval; \
119
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
120
CV_Error_(cv::Error::StsInternal, \
121
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res));
122
123
124
#define CALL_HAL(name, fun, ...) \
125
{ \
126
int res = __CV_EXPAND(fun(__VA_ARGS__)); \
127
if (res == CV_HAL_ERROR_OK) \
128
return; \
129
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
130
CV_Error_(cv::Error::StsInternal, \
131
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res)); \
132
}
133
//! @endcond
134
135
#endif
136
137