Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/features2d/src/kaze/utils.h
16337 views
1
#ifndef __OPENCV_FEATURES_2D_KAZE_UTILS_H__
2
#define __OPENCV_FEATURES_2D_KAZE_UTILS_H__
3
4
/* ************************************************************************* */
5
/**
6
* @brief This function computes the value of a 2D Gaussian function
7
* @param x X Position
8
* @param y Y Position
9
* @param sig Standard Deviation
10
*/
11
inline float gaussian(float x, float y, float sigma) {
12
return expf(-(x*x + y*y) / (2.0f*sigma*sigma));
13
}
14
15
/* ************************************************************************* */
16
/**
17
* @brief This function checks descriptor limits
18
* @param x X Position
19
* @param y Y Position
20
* @param width Image width
21
* @param height Image height
22
*/
23
inline void checkDescriptorLimits(int &x, int &y, int width, int height) {
24
25
if (x < 0) {
26
x = 0;
27
}
28
29
if (y < 0) {
30
y = 0;
31
}
32
33
if (x > width - 1) {
34
x = width - 1;
35
}
36
37
if (y > height - 1) {
38
y = height - 1;
39
}
40
}
41
42
#endif
43
44