ImageD  v2_7_5 (24.06.22)
ImageD is an image processing software designed for rapid prototyping and implementing algorithms and solutions for science, research and teaching.
d_geo_lineset_2d.h
Go to the documentation of this file.
1 /************************************
2  * added: 07.04.2021 *
3  * author: David Eilenstein *
4  * contact: D.Eilenstein@gsi.de *
5  * project: ImageD *
6  * facility: GSI Darmstadt, Ger *
7  ************************************/
8 
9 #ifndef D_GEO_LINESET_2D_H
10 #define D_GEO_LINESET_2D_H
11 
12 //own
13 #include <d_enum.h>
14 #include <d_geo_point_2d.h>
15 #include <d_geo_line_2d.h>
16 #include <d_geo_pointset_2d.h>
17 
18 //general
19 #include <iostream>
20 #include <vector>
21 #include <fstream>
22 #include <math.h>
23 #include <thread>
24 #include <time.h>
25 
26 //Qt
27 #include <QDebug>
28 
29 //openCV
30 #include <opencv2/core/core.hpp>
31 #include <opencv2/highgui/highgui.hpp>
32 #include <opencv2/imgproc/imgproc.hpp>
33 
34 //namespaces
35 using namespace std;
36 //using namespace cv; (prohibited because of abigous names with qtdatavisualization)
37 #include <d_opencv_typedefs.h>
38 
40 {
41 public:
42  //constructors
44  D_Geo_LineSet_2D(vector<D_Geo_Line_2D> lines);
45 
46  //add lines
47  void add_line(D_Geo_Line_2D line);
48  void add_line_point_point(D_Geo_Point_2D P1, D_Geo_Point_2D P2);
49  void add_line_point_direction(D_Geo_Point_2D P_support, D_Geo_Point_2D direction);
50  void add_line_point_angle(D_Geo_Point_2D P_support, double angle_rad);
51 
52  //getter
53  D_Geo_LineSet_2D subset_random(double rel_size);
54  D_Geo_Line_2D line(size_t i);
55  size_t size();
56 
57  //intersections
58 
59  //pairwise intersections
60  D_Geo_PointSet_2D intersections_pairwise();
61 
62  //center of intersections
63  D_Geo_Point_2D intersection(double *deviation);
64  D_Geo_Point_2D intersection(double *deviation, vector<double> *v_residuals);
65  D_Geo_Point_2D intersection_ransac(double *least_deviation, double lines_needed_for_modell_rel, double p_good_guess, double p_outliers, bool subset_of_points_not_lines);
66  D_Geo_Point_2D intersection_ransac(double *least_deviation, double subset_size_rel, size_t iterations, bool subset_of_points_not_lines);
67  D_Geo_Point_2D intersection_ransac(double *least_deviation, D_Geo_PointSet_2D *IntersectionsUsed, vector<double> *v_residuals, double subset_size_rel, size_t iterations, bool subset_of_points_not_lines);
68 
69  //k-means clustering of pairwise intersections
70  D_Geo_PointSet_2D intersections_clustered_kmeans(double *deviation, size_t k, size_t iterations);
71  D_Geo_PointSet_2D intersections_clustered_kmeans_ransac(double *deviation, size_t clustering_k, size_t clustering_iterations, double ransac_subset_size_rel, size_t ransac_iterations);
72 
73 private:
74  vector<D_Geo_Line_2D> v_lines;
75 
76  //threaded ransac
77  static void intersection_ransac_thread(D_Geo_LineSet_2D *line_set, D_Geo_Point_2D *center_best, double *least_deviation, D_Geo_PointSet_2D *IntersectionsUsed, vector<double> *v_residuals, double subset_size_rel, size_t iterations, bool subset_of_points_not_lines);
78 
79 };
80 
81 #endif // D_GEO_LINESET_2D_H
D_Geo_LineSet_2D::size
size_t size()
D_Geo_LineSet_2D::size number of lines in line set.
Definition: d_geo_lineset_2d.cpp:84
D_Geo_LineSet_2D
Definition: d_geo_lineset_2d.h:40
D_Geo_LineSet_2D::intersection_ransac
D_Geo_Point_2D intersection_ransac(double *least_deviation, double lines_needed_for_modell_rel, double p_good_guess, double p_outliers, bool subset_of_points_not_lines)
D_Geo_LineSet_2D::intersection_ransac Find best guess for intersections center of line set.
Definition: d_geo_lineset_2d.cpp:123
d_geo_pointset_2d.h
D_Geo_LineSet_2D::add_line_point_angle
void add_line_point_angle(D_Geo_Point_2D P_support, double angle_rad)
Definition: d_geo_lineset_2d.cpp:38
D_Geo_LineSet_2D::D_Geo_LineSet_2D
D_Geo_LineSet_2D()
Definition: d_geo_lineset_2d.cpp:11
D_Geo_PointSet_2D::subset_random
D_Geo_PointSet_2D subset_random(double rel_size)
D_Geo_PointSet_2D::random_subset takes a subset of the line set for i.e. RANSAC methods.
Definition: d_geo_pointset_2d.cpp:26
D_Geo_LineSet_2D::intersections_pairwise
D_Geo_PointSet_2D intersections_pairwise()
D_Geo_LineSet_2D::intersections_pairwise calc pairwise intersections of lines in set.
Definition: d_geo_lineset_2d.cpp:93
D_Geo_LineSet_2D::add_line_point_point
void add_line_point_point(D_Geo_Point_2D P1, D_Geo_Point_2D P2)
Definition: d_geo_lineset_2d.cpp:26
d_geo_lineset_2d.h
D_Geo_LineSet_2D::intersections_clustered_kmeans
D_Geo_PointSet_2D intersections_clustered_kmeans(double *deviation, size_t k, size_t iterations)
Definition: d_geo_lineset_2d.cpp:212
D_Geo_Line_2D
The D_Geo_Line_2D class represents a 2D line and offers usefulls methods for standard tasks for 2D po...
Definition: d_geo_line_2d.h:43
D_Geo_LineSet_2D::subset_random
D_Geo_LineSet_2D subset_random(double rel_size)
D_Geo_LineSet_2D::subset_random takes a subset of the line set for i.e. RANSAC methods.
Definition: d_geo_lineset_2d.cpp:50
d_geo_line_2d.h
D_Geo_LineSet_2D::intersection
D_Geo_Point_2D intersection(double *deviation)
Definition: d_geo_lineset_2d.cpp:105
D_Geo_PointSet_2D::centers_clusters_kmeans
D_Geo_PointSet_2D centers_clusters_kmeans(size_t k, size_t iterations, double *deviation)
Definition: d_geo_pointset_2d.cpp:185
d_geo_point_2d.h
D_Geo_PointSet_2D::add_point
void add_point(D_Geo_Point_2D P)
Definition: d_geo_pointset_2d.h:45
D_Geo_LineSet_2D::add_line_point_direction
void add_line_point_direction(D_Geo_Point_2D P_support, D_Geo_Point_2D direction)
Definition: d_geo_lineset_2d.cpp:31
D_Geo_PointSet_2D
Definition: d_geo_pointset_2d.h:38
D_Geo_LineSet_2D::intersections_clustered_kmeans_ransac
D_Geo_PointSet_2D intersections_clustered_kmeans_ransac(double *deviation, size_t clustering_k, size_t clustering_iterations, double ransac_subset_size_rel, size_t ransac_iterations)
Definition: d_geo_lineset_2d.cpp:217
d_opencv_typedefs.h
D_Geo_Line_2D::set_point_direction
bool set_point_direction(D_Geo_Point_2D P_support, D_Geo_Point_2D direction)
Definition: d_geo_line_2d.cpp:50
D_Geo_LineSet_2D::add_line
void add_line(D_Geo_Line_2D line)
Definition: d_geo_lineset_2d.cpp:21
d_enum.h
D_Geo_PointSet_2D::center
D_Geo_Point_2D center()
D_Geo_PointSet_2D::center calc center of the point set.
Definition: d_geo_pointset_2d.cpp:119
D_Geo_LineSet_2D::line
D_Geo_Line_2D line(size_t i)
Definition: d_geo_lineset_2d.cpp:75
D_Geo_Point_2D
The D_Geo_Point_2D class represents a 2D point and offers usefulls methods for standard tasks for 2D ...
Definition: d_geo_point_2d.h:43
D_Geo_Line_2D::set_point_angle
bool set_point_angle(D_Geo_Point_2D P_support, double angle_rad)
Definition: d_geo_line_2d.cpp:55