85540659e00d05bfb0f4102be11bfebeee159c7a
[platform/upstream/opencv.git] / modules / objdetect / src / _lsvm_distancetransform.h
1 #ifndef _LSVM_DIST_TRANSFORM_H_
2 #define _LSVM_DIST_TRANSFORM_H_
3
4 #include "_lsvm_types.h"
5 #include "_lsvm_error.h"
6
7 /*
8 // Computation the point of intersection functions
9 // (parabolas on the variable y)
10 //      a(y - q1) + b(q1 - y)(q1 - y) + f[q1]
11 //      a(y - q2) + b(q2 - y)(q2 - y) + f[q2]
12 //
13 // API
14 // int GetPointOfIntersection(const F_type *f,
15                               const F_type a, const F_type b,
16                               int q1, int q2, F_type *point);
17 // INPUT
18 // f                - function on the regular grid
19 // a                - coefficient of the function
20 // b                - coefficient of the function
21 // q1               - parameter of the function
22 // q2               - parameter of the function
23 // OUTPUT
24 // point            - point of intersection
25 // RESULT
26 // Error status
27 */
28 int GetPointOfIntersection(const float *f,
29                            const float a, const float b,
30                            int q1, int q2, float *point);
31
32 /*
33 // Decision of one dimensional problem generalized distance transform
34 // on the regular grid at all points
35 //      min (a(y' - y) + b(y' - y)(y' - y) + f(y')) (on y')
36 //
37 // API
38 // int DistanceTransformOneDimensionalProblem(const F_type *f, const int n,
39                                               const F_type a, const F_type b,
40                                               F_type *distanceTransform,
41                                               int *points);
42 // INPUT
43 // f                 - function on the regular grid
44 // n                 - grid dimension
45 // a                 - coefficient of optimizable function
46 // b                 - coefficient of optimizable function
47 // OUTPUT
48 // distanceTransform - values of generalized distance transform
49 // points            - arguments that corresponds to the optimal value of function
50 // RESULT
51 // Error status
52 */
53 int DistanceTransformOneDimensionalProblem(const float *f, const int n,
54                                            const float a, const float b,
55                                            float *distanceTransform,
56                                            int *points);
57
58 /*
59 // Computation next cycle element
60 //
61 // API
62 // int GetNextCycleElement(int k, int n, int q);
63 // INPUT
64 // k                 - index of the previous cycle element
65 // n                 - number of matrix rows
66 // q                 - parameter that equal (number_of_rows * number_of_columns - 1)
67 // OUTPUT
68 // None
69 // RESULT
70 // Next cycle element
71 */
72 int GetNextCycleElement(int k, int n, int q);
73
74 /*
75 // Transposition of cycle elements
76 //
77 // API
78 // void TransposeCycleElements(F_type *a, int *cycle, int cycle_len);
79 // INPUT
80 // a                 - initial matrix
81 // cycle             - cycle
82 // cycle_len         - cycle length
83 // OUTPUT
84 // a                 - matrix with transposed elements
85 // RESULT
86 // None
87 */
88 void TransposeCycleElements(float *a, int *cycle, int cycle_len);
89
90 /*
91 // Getting transposed matrix
92 //
93 // API
94 // void Transpose(F_type *a, int n, int m);
95 // INPUT
96 // a                 - initial matrix
97 // n                 - number of rows
98 // m                 - number of columns
99 // OUTPUT
100 // a                 - transposed matrix
101 // RESULT
102 // Error status
103 */
104 void Transpose(float *a, int n, int m);
105
106 /*
107 // Decision of two dimensional problem generalized distance transform
108 // on the regular grid at all points
109 //      min{d2(y' - y) + d4(y' - y)(y' - y) +
110             min(d1(x' - x) + d3(x' - x)(x' - x) + f(x',y'))} (on x', y')
111 //
112 // API
113 // int DistanceTransformTwoDimensionalProblem(const F_type *f,
114                                               const int n, const int m,
115                                               const F_type coeff[4],
116                                               F_type *distanceTransform,
117                                               int *pointsX, int *pointsY);
118 // INPUT
119 // f                 - function on the regular grid
120 // n                 - number of rows
121 // m                 - number of columns
122 // coeff             - coefficients of optimizable function
123                        coeff[0] = d1, coeff[1] = d2,
124                        coeff[2] = d3, coeff[3] = d4
125 // OUTPUT
126 // distanceTransform - values of generalized distance transform
127 // pointsX           - arguments x' that correspond to the optimal value
128 // pointsY           - arguments y' that correspond to the optimal value
129 // RESULT
130 // Error status
131 */
132 int DistanceTransformTwoDimensionalProblem(const float *f,
133                                            const int n, const int m,
134                                            const float coeff[4],
135                                            float *distanceTransform,
136                                            int *pointsX, int *pointsY);
137
138 #endif