-
Notifications
You must be signed in to change notification settings - Fork 1
/
Find the best lines.h
121 lines (110 loc) · 6.39 KB
/
Find the best lines.h
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
////
//// Find the best lines.h
////
//// Created by Chienfu Huang on 2014/5/22.
//// Copyright (c) 2014年 Chienfu Huang. All rights reserved.
////
//#include <iostream>
//#include <cv.h>
//#include <highgui.h>
//#include <vector>
//#include <math.h>
//#include "Vanishing Point.h"
//
//#ifndef __MacOpenCV__Find_the_best_lines__
//#define __MacOpenCV__Find_the_best_lines__
//
////find_the_best_line回傳資料結構
//class FTBL
//{
//public:
// CvPoint FTBL_Point_L;
// CvPoint FTBL_Point_R;
// FTBL();
// FTBL(CvPoint Point_data_L, CvPoint Point_data_R);
//};
//
////線段分群類別
//class line_group
//{
//public:
// CvPoint GroupPoint;
// int GroupScore;
// double angle;
// double group_line_slope;
// double group_slope;
// line_group(CvPoint firstPoint);
// line_group(CvPoint firstPoint,double firstslope);
// void update(CvPoint newPoint);
// void update(CvPoint newPoint,double newslope);
// double calculate_the_angle(CvPoint Vanishing_Point);
//};
////分群Vector sort
//bool sort_for_line_group_class(const line_group a, const line_group b);
//bool sort_for_line_group_class_ANGLE(const line_group a, const line_group b);
//
////畫出範圍框
//void draw_VPoint(IplImage* img, int x, int y, int vp_range);
//
////找出最佳車道線 (原始彩圖,完整Canny,消失點位置,消失點周圍範圍)
//FTBL FindTheBestLines(IplImage* Ori_pic,vector<line_property> *AllHLineSlope, CvPoint vpfnpoint, int vp_range);
//
////計算延伸線段座標
//CvPoint Calculation_extension(CvPoint Vanishing_Point, double slope, int y);
////算截距
//double calculate_intercept(CvPoint point_1,double line_slope);
//
//#endif /* defined(__MacOpenCV__Find_the_best_lines__) */
#include <iostream>
#include <cv.h>
#include <highgui.h>
#include <vector>
#include <math.h>
#include "Vanishing Point.h"
#ifndef __MacOpenCV__Find_the_best_lines__
#define __MacOpenCV__Find_the_best_lines__
//find_the_best_line回傳資料結構
class FTBL
{
public:
CvPoint FTBL_Point_L;
CvPoint FTBL_Point_R;
FTBL();
FTBL(CvPoint Point_data_L, CvPoint Point_data_R);
};
//線段分群類別
class line_group
{
protected:
vector<int> LineNumTable;
vector<line_property> *OmniLineData;
public:
CvPoint GroupPoint;
CvPoint GroupPoint_up;
int GroupScore;
double angle;
double group_line_slope;
double group_slope;
line_group(CvPoint firstPoint);
line_group(CvPoint firstPoint,double firstslope);
line_group(vector<line_property> *line,int LineNum);
void update(CvPoint newPoint);
void update(CvPoint newPoint,double newslope);
void update(int LineNum);
double calculate_the_angle(CvPoint Vanishing_Point);
//確認是否為該群線段
bool CompareLine2Group (int LineNum, int range, double lenRange);
double countDistance (CvPoint line1,CvPoint line2);
};
//分群Vector sort
bool sort_for_line_group_class(const line_group a, const line_group b);
bool sort_for_line_group_class_ANGLE(const line_group a, const line_group b);
//畫出範圍框
void draw_VPoint(IplImage* img, int x, int y, int vp_range);
//找出最佳車道線 (原始彩圖,完整Canny,消失點位置,消失點周圍範圍)
FTBL FindTheBestLines(IplImage* Ori_pic,vector<line_property> *AllHLineSlope, CvPoint vpfnpoint, int vp_range);
//計算延伸線段座標
CvPoint Calculation_extension(CvPoint Vanishing_Point, double slope, int y);
//算截距
double calculate_intercept(CvPoint point_1,double line_slope);
#endif /* defined(__MacOpenCV__Find_the_best_lines__) */