forked from torresszy/auto_calibration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathline_extractor.hpp
216 lines (148 loc) · 5.43 KB
/
line_extractor.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#ifndef line_extractor_hpp
#define line_extractor_hpp
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/ximgproc/fast_line_detector.hpp>
#include <opencv2/ximgproc/edge_drawing.hpp>
#include <iostream>
#include <stdio.h>
#include "glog/logging.h"
using namespace cv;
using namespace std;
/* Struct holding the parameters for one camera */
struct CalibParams
/* Struct for all four cameras */
struct camera_set
/* Struct for lanemarks */
struct lanemarks
struct one_frame_lines
struct one_frame_lines_set
struct vanishing_pts
/* create a new CalibParams struct and initialize it
* Parameters see definition for CalibParams
*/
CalibParams* camera_new;
one_frame_lines_set* one_frame_set_new();
/* Initialize the intrinsic parameters based on a camera
*
* camera: a pointer to CalibParams holding the parameters of the camera
* cam_matrix: a pointer holding the return val&ue of the camera matrix
* dist_coeffs: a pointer holding the return value of the distortion coefficients
*/
void init_intrinsic;
/* Calculate the rotation matrix R based on a camera's pitch, yaw, and roll angles
*
* camera: a pointer to CalibParams holding the parameters of the camera
* R: a pointer holding the return value of the rotation matrix
*/
void rotation_homography;
/* Calculate the translation matrix R based on the rotation matrix
* ******rotation_homography MUST BE CALLED FIRST******
*
* camera: a pointer to CalibParams holding the parameters of the camera
* R: a pointer holding the return value of the rotation matrix
* T: a pointer holding the return value of the translation matrix
*/
void translation_homography;
void ENURotationFromEuler;
/* Adjust the orientation of the rotation and translation matrix from zyx to yxz
*
* R: a pointer to the rotation matrix
* T: a pointer to the translation matrix
*/
void homography_adjust;
//RANSAC fit 2D straight line
//Input parameters: points--input point set
// iterations--number of iterations
// sigma--The acceptable difference between the data and the model, the lane line pixel bandwidth is generally about 10
// (Parameter use to compute the fitting score)
// k_min/k_max--The value range of the slope of the fitted straight line.
// Considering that the slope of the left and right lane lines in the image is within a certain range,
// Adding this parameter can also avoid detecting vertical and horizontal lines
//Output parameters: line--fitted line parameters, It is a vector of 4 floats
// (vx, vy, x0, y0) where (vx, vy) is a normalized
// vector collinear to the line and (x0, y0) is some
// point on the line.
//Return value: none
//void fitLineRansac(const std::vector<cv::Point2f>& points,
// cv::Vec4f &line,
// int iterations = 1000,
// double sigma = 1.,
// double k_min = -7.,
// double k_max = 7.);
/* Detects the lanemark lines in the birdeye image
*
* birdeye_img: a pointer to the birdeye image
*/
void detect_line;
/* transorm one fisheye image into a birdeye image with the camera parameters
*
* camera: a pointer to CalibParams holding the parameters of the camera
* img: a pointer to the fisheye image
*/
void birdeye_oneview_transform;
void oneview_extract_line;
/* transform all four fisheye images with four cameras' parameters
*
* cameras: a pointer to camera_set struct holding parameters of all four cameras
* all_img: a pointer to all four fisheye images
*/
void birdeye_transform;
void line_pairing;
//RANSAC fit 2D straight line
//Input parameters: points--input point set
// iterations--number of iterations
// sigma--The acceptable difference between the data and the model, the lane line pixel bandwidth is generally about 10
// (Parameter use to compute the fitting score)
// k_min/k_max--The value range of the slope of the fitted straight line.
// Considering that the slope of the left and right lane lines in the image is within a certain range,
// Adding this parameter can also avoid detecting vertical and horizontal lines
//Output parameters: line--fitted line parameters, It is a vector of 4 floats
// (vx, vy, x0, y0) where (vx, vy) is a normalized
// vector collinear to the line and (x0, y0) is some
// point on the line.
//Return value: none
void fitLineRansac;
static float GetDist;
// get angle with positive vale between 2 line segments
static float GetAngle;
// get angle with positive value between input line and iamge x axis
static float GetAngle;
static float GetX;
// determine whether 2 lines is colinear
static float GetSimilarity;
static void Kmeans;
void FilterLines;
void duplicate_filter;
void length_filter;
void range_filter;
void orientation_filter;
void average_vanish_pt;
void get_vanish_pt;
double get_pitch;
void get_Hmax;
void side_cam_Hmax;
void front_back_cam_Hmax;
void get_h;
void get_h;
void get_h;
void calculate_H;
void get_virtual_K;
void get_updated_R;
double get_rotation_axis_and_angle;
void outlier_filter;
float get_slope;
float get_intercept;
float get_x;
bool location_check;
void find_closest_lane;
bool cluter_filter;
void get_cluster_median;
void cluster_vpt_set;
void lanes_filter;
#endif /* line_extractor_hpp */