-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graphics.hpp
1069 lines (1069 loc) · 39.4 KB
/
Graphics.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ifndef GRAPHICS_OMID_SOJOODI
/**
* @file Graphics.hpp
* @author Ramtin Kosari (ramtinkosari@gmail.com)
* @brief Graphics Header File
* @date 2024-04-14
* @def GRAPHICS_OMID_SOJOODI
* @brief Graphics Header File Macro
* @details This Header File Contains All the Required Libraries and Classes for Graphical Visualization
*/
# define GRAPHICS_OMID_SOJOODI
//-- Include OpenCV HighGUI
# ifndef OPENCV_HIGHGUI_HPP
# include "opencv4/opencv2/highgui.hpp"
# endif // OPENCV_HIGHGUI_HPP
//-- Include OpenCV ImgProc
# ifndef OPENCV_IMGPROC_HPP
# include "opencv4/opencv2/imgproc.hpp"
# endif // OPENCV_IMGPROC_HPP
//-- Include OpenCV Viz
// # ifndef OPENCV_VIZ_HPP
// # include "opencv4/opencv2/viz.hpp"
// # endif // OPENCV_VIZ_HPP
//-- Include IOmanip
# ifndef _GLIBCXX_IOMANIP
# include <iomanip>
# endif // _GLIBCXX_IOMANIP
//-- Include X11
# ifndef _X11_XLIB_H_
# include <X11/Xlib.h>
# endif // _X11_XLIB_H_
//-- Include Exception
# ifndef __EXCEPTION__
# include <exception>
# endif // _GLIBCXX_EXCEPTION
//-- Include Configurations
# ifndef ALGORITHMS_OMID_SOJOODI_CONFIGS
# include "Configs.hpp"
# endif // ALGORITHMS_OMID_SOJOODI_CONFIGS
/**
* @brief Cyan Color Configuration
* @details This Macro Defines the Cyan Color
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define COLOR_CYAN cv::Scalar(255, 255, 0)
/**
* @brief Dark Cyan Color Configuration
* @details This Macro Defines the Dark Cyan Color
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define COLOR_CYAN_DARK cv::Scalar(170, 170, 0)
/**
* @def WINDOW_WIDTH
* @brief Window Width Configuration
* @details This Macro Defines the Width of the Window
*/
# define WINDOW_WIDTH 1730
/**
* @def WINDOW_HEIGHT
* @brief Window Height Configuration
* @details This Macro Defines the Height of the Window
*/
# define WINDOW_HEIGHT 1730
/**
* @def WINDOW_NAME
* @brief Window Name Configuration
* @details This Macro Defines the Name of the Window
*/
# define WINDOW_NAME "Graphical View"
/**
* @def WINDOW_BACKGROUND
* @brief Window Background Configuration
* @details This Macro Defines the Background Color of the Window
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define WINDOW_BACKGROUND cv::Scalar(20, 10, 0)
/**
* @def WINDOWS_PADDING
* @brief Windows Padding Configuration
* @details This Macro Defines the Padding between the Windows
*/
# define WINDOWS_PADDING 50
/**
* @def INFO_WINDOW_WIDTH
* @brief Info Window Width Configuration
* @details This Macro Defines the Width of the Info Window
*/
# define INFO_WINDOW_WIDTH WINDOW_WIDTH / 3
/**
* @def INFO_WINDOW_HEIGHT
* @brief Info Window Height Configuration
* @details This Macro Defines the Height of the Info Window
*/
# define INFO_WINDOW_HEIGHT WINDOW_HEIGHT / 1.5
/**
* @def INFO_WINDOW_NAME
* @brief Info Window Name Configuration
* @details This Macro Defines the Name of the Info Window
*/
# define INFO_WINDOW_NAME "Info"
/**
* @brief Info Window Button Width Configuration
* @details This Macro Defines the Info Window Button Width
*/
# define INFO_WINDOW_BUTTON_WIDTH INFO_WINDOW_WIDTH / 4
/**
* @brief Info Window Button Height Configuration
* @details This Macro Defines the Info Window Button Height
*/
# define INFO_WINDOW_BUTTON_HEIGHT INFO_WINDOW_WIDTH / 4
/**
* @brief Info Window Button Color Configuration
* @details This Macro Defines the Info Window Button Color
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define INFO_WINDOW_BUTTON_COLOR cv::Scalar(255, 255, 255)
/**
* @brief Info Window Button Text Configuration
* @details This Macro Defines the Info Window Button Text
*/
# define INFO_WINDOW_BUTTON_TEXT "Home"
/**
* @brief Info Window Button Text Color Configuration
* @details This Macro Defines the Info Window Button Text Color
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define INFO_WINDOW_BUTTON_TEXT_COLOR cv::Scalar(0, 0, 0)
/**
* @brief Info Window Button Text Thickness Configuration
* @details This Macro Defines the Info Window Button Text Thickness
*/
# define INFO_WINDOW_BUTTON_TEXT_SIZE 0.5
/**
* @brief Info Window Button Text Thickness Configuration
* @details This Macro Defines the Info Window Button Text Thickness
*/
# define INFO_WINDOW_BUTTON_TEXT_THICKNESS 1
/**
* @def POINT_RADIUS
* @brief Point Radius Configuration
* @details This Macro Defines the Radius of the Point
*/
# define POINT_RADIUS 1
/**
* @def POINT_THICKNESS
* @brief Point Thickness Configuration
* @details This Macro Defines the Thickness of the Point
*/
# define POINT_THICKNESS -1
/**
* @def POINT_COLOR
* @brief Point Color Configuration
* @details This Macro Defines the Color of the Point
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_COLOR cv::Scalar(170, 170, 0)
/**
* @def POINT_RING_RADIUS
* @brief Point Ring Radius Configuration
* @details This Macro Defines the Radius of the Ring around the Point
*/
# define POINT_RING_RADIUS 7
/**
* @def POINT_RING_LINE_BEGIN
* @brief Point Ring Line Begin Configuration
* @details This Macro Defines the Begin Distance of the Lines around the Point
*/
# define POINT_RING_LINE_BEGIN POINT_RING_RADIUS - 2
/**
* @def POINT_RING_LINE_SIZE
* @brief Point Ring Line Size Configuration
* @details This Macro Defines the Size of the Lines around the Point
*/
# define POINT_RING_LINE_SIZE 9
/**
* @def POINT_RING_COLOR
* @brief Point Ring Color Configuration
* @details This Macro Defines the Color of the Ring around the Point
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_RING_COLOR cv::Scalar(90, 209, 137)
/**
* @def POINT_RING_LINE_COLOR
* @brief Point Ring Line Color Configuration
* @details This Macro Defines the Color of the Lines around the Point
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_RING_LINE_COLOR cv::Scalar(76, 147, 22)
/**
* @def POINT_RING_THICKNESS
* @brief Point Ring Thickness Configuration
* @details This Macro Defines the Thickness of the Ring around the Point
*/
# define POINT_RING_THICKNESS 1
/**
* @def POINT_INFO_BOX_CIRCLE_RADIUS
* @brief Point Info Box Circle Radius Configuration
* @details This Macro Defines the Radius of the Circle in the Info Box
*/
# define POINT_INFO_BOX_CIRCLE_RADIUS 5
/**
* @def POINT_INFO_BOX_LINE_1_SIZE
* @brief Point Info Box Line 1 Size Configuration
* @details This Macro Defines the Size of the Line 1 in the Info Box
*/
# define POINT_INFO_BOX_LINE_1_SIZE 60
/**
* @def POINT_INFO_BOX_LINE_1_ANGLE
* @brief Point Info Box Line 1 Angle Configuration
* @details This Macro Defines the Angle of the Line 1 in the Info Box
*/
# define POINT_INFO_BOX_LINE_1_ANGLE 37
/**
* @def POINT_INFO_BOX_LINE_1_COLOR
* @brief Point Info Box Line 1 Color Configuration
* @details This Macro Defines the Color of the Line 1 in the Info Box
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_INFO_BOX_LINE_1_COLOR cv::Scalar(196, 137, 137)
/**
* @def POINT_INFO_BOX_LINE_1_THICKNESS
* @brief Point Info Box Line 1 Thickness Configuration
* @details This Macro Defines the Thickness of the Line 1 in the Info Box
*/
# define POINT_INFO_BOX_LINE_1_THICKNESS 1
/**
* @def POINT_INFO_BOX_LINE_2_SIZE
* @brief Point Info Box Line 2 Size Configuration
* @details This Macro Defines the Size of the Line 2 in the Info Box
*/
# define POINT_INFO_BOX_LINE_2_SIZE 30
/**
* @def POINT_INFO_BOX_LINE_2_COLOR
* @brief Point Info Box Line 2 Color Configuration
* @details This Macro Defines the Color of the Line 2 in the Info Box
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_INFO_BOX_LINE_2_COLOR cv::Scalar(196, 137, 137)
/**
* @def POINT_INFO_BOX_LINE_2_THICKNESS
* @brief Point Info Box Line 2 Thickness Configuration
* @details This Macro Defines the Thickness of the Line 2 in the Info Box
*/
# define POINT_INFO_BOX_LINE_2_THICKNESS 1
/**
* @def POINT_INFO_BOX_WIDTH
* @brief Point Info Box Width Configuration
* @details This Macro Defines the Width of the Info Box
*/
# define POINT_INFO_BOX_WIDTH 80
/**
* @def POINT_INFO_BOX_HEIGHT
* @brief Point Info Box Height Configuration
* @details This Macro Defines the Height of the Info Box
*/
# define POINT_INFO_BOX_HEIGHT 37
/**
* @def POINT_INFO_BOX_COLOR
* @brief Point Info Box Color Configuration
* @details This Macro Defines the Color of the Info Box
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_INFO_BOX_COLOR cv::Scalar(37, 15, 2)
/**
* @def POINT_INFO_BOX_TEXT_SIZE
* @brief Point Info Box Text Size Configuration
* @details This Macro Defines the Size of the Text in the Info Box
*/
# define POINT_INFO_BOX_TEXT_PADDING 5
/**
* @def POINT_INFO_BOX_TEXT_SIZE
* @brief Point Info Box Text Size Configuration
* @details This Macro Defines the Size of the Text in the Info Box
*/
# define POINT_INFO_BOX_TEXT_SIZE 0.4
/**
* @def POINT_INFO_BOX_TEXT_THICKNESS
* @brief Point Info Box Text Thickness Configuration
* @details This Macro Defines the Thickness of the Text in the Info Box
*/
# define POINT_INFO_BOX_TEXT_THICKNESS 1
/**
* @def POINT_INFO_BOX_TEXT_COLOR
* @brief Point Info Box Text Color Configuration
* @details This Macro Defines the Color of the Text in the Info Box
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define POINT_INFO_BOX_TEXT_COLOR cv::Scalar(255, 255, 255)
/**
* @def POINT_INFO_BOX_NEXT_LINE
* @brief Point Info Box Next Line Configuration
* @details This Macro Defines Distance of the Next Line in the Info Box
*/
# define POINT_INFO_BOX_NEXT_LINE 15
/**
* @def LINE_TICKNESS
* @brief Line Thickness Configuration
* @details This Macro Defines the Thickness of the Line
*/
# define LINE_TICKNESS 1
/**
* @def LINE_COLOR
* @brief Line Color Configuration
* @details This Macro Defines the Color of the Line
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define LINE_COLOR cv::Scalar(0, 255, 255)
/**
* @def LINE_WEIGHT_TEXT_SIZE
* @brief Line Weight Text Size Configuration
* @details This Macro Defines the Size of the Text for Line Weight
*/
# define LINE_WEIGHT_TEXT_SIZE 0.6
/**
* @def LINE_WEIGHT_TEXT_THICKNESS
* @brief Line Weight Text Thickness Configuration
* @details This Macro Defines the Thickness of the Text for Line Weight
*/
# define LINE_WEIGHT_TEXT_THICKNESS 2
/**
* @def LINE_WEIGHT_TEXT_COLOR
* @brief Line Weight Text Color Configuration
* @details This Macro Defines the Color of the Text for Line Weight
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define LINE_WEIGHT_TEXT_COLOR cv::Scalar(60, 0, 0)
/**
* @def LINE_WEIGHT_BACKGROUND_COLOR
* @brief Line Weight Background Color Configuration
* @details This Macro Defines the Background Color of the Text for Line Weight
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define LINE_WEIGHT_BACKGROUND_COLOR cv::Scalar(217, 245, 177)
/**
* @def LINE_WEIGHT_BACKGROUND_PADDING
* @brief Line Weight Background Padding Configuration
* @details This Macro Defines the Padding of the Background of the Text for Line Weight
*/
# define LINE_WEIGHT_BACKGROUND_PADDING 6
/**
* @def BOX_COLOR
* @brief Box Color Configuration
* @details This Macro Defines the Color of the Box
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
# define BOX_COLOR cv::Scalar(40, 30, 0)
/**
* @def SHOW_FRAME_THRESHOLD
* @brief Show Frame Threshold Configuration
* @details This Macro Defines the Threshold for Showing the Frame After Amount of Frame Update
*/
# define SHOW_FRAME_THRESHOLD 30
/**
* @enum ENUM_ALGORITHM_ENVIRONMENT
* @brief Algorithm Environment
* @details This Enum Defines the Environment of the Algorithm
* @param ENVIRONMENT_1D 1D Environment
* @param ENVIRONMENT_2D 2D Environment
* @param ENVIRONMENT_3D 3D Environment
*/
enum ENUM_ALGORITHM_ENVIRONMENT {
ENVIRONMENT_1D,
ENVIRONMENT_2D,
ENVIRONMENT_3D
};
/**
* @enum ENUM_SHOW_POINT_METHODS
* @brief Show Point Methods Enum
* @details This Enum Defines the Method of Showing the Point
* @param SHOW_POINT_INFO_BOX Show Point with Info Box
* @param SHOW_POINT_NORMAL Show Point Normal
* @param SHOW_POINT_RING Show Ring around Point
*/
enum ENUM_SHOW_POINT_METHODS {
SHOW_POINT_INFO_BOX,
SHOW_POINT_NORMAL,
SHOW_POINT_RING
};
/**
* @enum ENUM_SHOW_LINE_METHODS
* @brief Show Line Methods Enum
* @details This Enum Defines the Method of Showing the Line
* @param SHOW_LINE_NORMAL Show Line Normal
* @param SHOW_LINE_WEIGHTED Show Line Weighted
*/
enum ENUM_SHOW_LINE_METHODS {
SHOW_LINE_NORMAL,
SHOW_LINE_WEIGHTED
};
/**
* @enum ENUM_SHOW_WINDOW_MODE
* @brief Show on Window Mode Enum
* @details This Enum Defines the Mode of Showing on the Window
* @param SHOW_ON_TEMP_WINDOW_RESET Show on Temp Window and Reset Temp Window each Time
* @param SHOW_ON_MAIN_WINDOW Show on Main Window
* @param SHOW_ON_TEMP_WINDOW Show on Temp Window
*/
enum ENUM_SHOW_WINDOW_MODE {
SHOW_ON_TEMP_WINDOW_RESET,
SHOW_ON_MAIN_WINDOW,
SHOW_ON_TEMP_WINDOW,
};
/**
* @enum ENUM_SHOW_BOX_METHODS
* @brief Show Box Methods Enum
* @details This Enum Defines the Method of Showing the Box
* @param SHOW_BOX_CHESS_COLORFUL_WEIGHTED Show Box with Colorful Chess and Weighted
* @param SHOW_BOX_NORMAL_WEIGHTED Show Box Normal with Weighted
* @param SHOW_BOX_CHESS_WEIGHTED Show Box with Weighted Chess
* @param SHOW_BOX_CHESS_COLORFUL Show Box with Colorful Chess
* @param SHOW_BOX_WEIGHTED Show Box with Weighted
* @param SHOW_BOX_NORMAL Show Box Normal
* @param SHOW_BOX_CHESS Show Box with Chess
*/
enum ENUM_SHOW_BOX_METHODS {
SHOW_BOX_CHESS_COLORFUL_WEIGHTED,
SHOW_BOX_NORMAL_WEIGHTED,
SHOW_BOX_CHESS_WEIGHTED,
SHOW_BOX_CHESS_COLORFUL,
SHOW_BOX_NORMAL,
SHOW_BOX_CHESS,
};
/**
* @namespace env
* @brief Environment Namespace
* @details This Namespace Contains All the Environment Classes for Algorithms
* @param Point2D 2D Point Class
* @param Point3D 3D Point Class
* @param Box2D 2D Box Class
* @param Box3D 3D Box Class
* @note All the Environment Properties Classes are Defined in this Namespace
*/
namespace env {
/**
* @class Point2D
* @brief 2D Point Class Definition
* @details This Class Contains the Definition of 2D Point and Its Properties
*
* @param x X Coordinate
* @param y Y Coordinate
* @param theta Angle
* @param color Color
*
* @note All the Properties are Public
* @note Method has Constructor with Parameters
* @note Method has Constructor without Parameters
*
* @warning This Class is Defined in @ref env Namespace
* @warning This Class Can be Used in 2D Environment Only
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
class Point2D {
public:
/**
* @brief X - Axis Coordinate
* @details This Variable Contains the X - Axis Coordinate of the Point
*/
double x;
/**
* @brief Y - Axis Coordinate
* @details This Variable Contains the Y - Axis Coordinate of the Point
*/
double y;
/**
* @brief Angle
* @details This Variable Contains the Angle of the Point
*/
double theta;
/**
* @brief Color
* @details This Variable Contains the Color of the Point
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
cv::Scalar color;
/**
* @brief Constructor
* @details This Constructor Initializes the Point with Default Values
*/
Point2D();
/**
* @brief Constructor with Parameters
* @details This Constructor Initializes the Point with Given Parameters
*
* @param _x X Coordinate
* @param _y Y Coordinate
* @param _theta Angle
* @param _color Color
*/
Point2D(
double _x,
double _y,
double _theta,
cv::Scalar _color
);
};
/**
* @class Point3D
* @brief 3D Point Class Definition
* @details This Class Contains the Definition of 3D Point and Its Properties
*
* @param x X Coordinate
* @param y Y Coordinate
* @param z Z Coordinate
* @param theta Angle
* @param color Color
*
* @note All the Properties are Public
* @note Method has Constructor with Parameters
* @note Method has Constructor without Parameters
*
* @warning This Class is Defined in @ref env Namespace
* @warning This Class Can be Used in 3D Environment Only
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
class Point3D {
public:
/**
* @brief X - Axis Coordinate
* @details This Variable Contains the X - Axis Coordinate of the Point
*/
double x;
/**
* @brief Y - Axis Coordinate
* @details This Variable Contains the Y - Axis Coordinate of the Point
*/
double y;
/**
* @brief Z - Axis Coordinate
* @details This Variable Contains the Z - Axis Coordinate of the Point
*/
double z;
/**
* @brief Angle
* @details This Variable Contains the Angle of the Point
*/
double theta;
/**
* @brief Color
* @details This Variable Contains the Color of the Point
* @note Color Object Must be cv::Scalar
* @note Format Must be BGR
*/
cv::Scalar color;
/**
* @brief Constructor
* @details This Constructor Initializes the Point with Default Values
*/
Point3D();
/**
* @brief Constructor with Parameters
* @details This Constructor Initializes the Point with Given Parameters
*
* @param _x X Coordinate
* @param _y Y Coordinate
* @param _z Z Coordinate
* @param _theta Angle
* @param _color Color
*/
Point3D(
double & _x,
double & _y,
double & _z,
double & _theta,
cv::Scalar & _color
);
};
/**
* @class Point3D
* @brief 3D Point Class Definition
* @details This Class Contains the Definition of 3D Point and Its Properties
*
* @param x X Coordinate
* @param y Y Coordinate
* @param z Z Coordinate
* @param theta Angle
* @param color Color
*
* @note All the Properties are Public
* @note Method has Constructor with Parameters
* @note Method has Constructor without Parameters
*
* @warning This Class is Defined in @ref env Namespace
* @warning This Class Can be Used in 3D Environment Only
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
/**
* @class Box2D
* @brief 2D Box Class Definition
* @details This Class Contains the Definition of 2D Box and Its Properties
*
* @param p1 First Point
* @param p2 Second Point
*
* @note All the Properties are Public
* @note Method has Default Constructor
*
* @warning This Class is Defined in @ref env Namespace
* @warning This Class Can be Used in 2D Environment Only
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
class Box2D {
public:
/**
* @brief Top Left Point
* @details This Variable Contains the Top Left Point of the Box
*/
Point2D p1;
/**
* @brief Bottom Right Point
* @details This Variable Contains the Bottom Right Point of the Box
*/
Point2D p2;
/**
* @brief Constructor
* @details This Constructor Initializes the Box with Default Values
*/
Box2D();
/**
* @brief Constructor with Parameters
* @details This Constructor Initializes the Box with Given Parameters
*
* @param _p1 First Point
* @param _p2 Second Point
*/
Box2D(
Point2D & _p1,
Point2D & _p2
);
};
/**
* @class Box3D
* @brief 3D Box Class Definition
* @details This Class Contains the Definition of 3D Box and Its Properties
*
* @param p1 Top Diameter Point
* @param p2 Down Diameter Point
*
* @note All the Properties are Public
* @note Method has Default Constructor
*
* @warning This Class is Defined in @ref env Namespace
* @warning This Class Can be Used in 3D Environment Only
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
class Box3D {
public:
/**
* @brief Top Diameter Point
* @details This Variable Contains the Top Diameter Point of the Box
*/
Point3D p1;
/**
* @brief Down Diameter Point
* @details This Variable Contains the Down Diameter Point of the Box
*/
Point3D p2;
/**
* @brief Constructor
* @details This Constructor Initializes the Box with Default Values
*/
Box3D();
};
}
/**
* @enum ENUM_MOUSE_STATE
* @brief Mouse State Enum
* @details This Enum Defines the State of the Mouse
* @param EVENTS_INACTIVE Mouse Events are Inactive
* @param EVENTS_ACTIVE Mouse Events are Active
*/
enum class ENUM_MOUSE_STATE {
EVENTS_INACTIVE,
EVENTS_ACTIVE
};
/**
* @class Graphics
* @brief Graphics Class Definition
* @details This Class Contains the Definition of Graphics and Its Properties
*
* @param environment Environment
* @param window Window Matrix
* @param tmp_windows Temp Windows
* @param points2D 2D Points Instance
* @param points3D 3D Points Instance
*
* @note All the Properties are Private
* @note Method has Constructor with Parameters
*
* @warning This Class is Defined in @ref env Namespace
* @warning This Class Can be Used in 2D and 3D Environment Only
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
class Graphics {
private:
/**
* @brief Environment
* @details This Variable Contains the Environment of the Algorithm
*
* @note Environment Must be ENUM_ALGORITHM_ENVIRONMENT
*
* @see ENUM_ALGORITHM_ENVIRONMENT
*/
ENUM_ALGORITHM_ENVIRONMENT environment;
/**
* @struct SCREEN
* @brief Screen Structure
* @details This Structure Contains the Screen Properties as Follows:
* @param width Width
* @param height Height
*/
struct STRUCT_SCREEN {
/**
* @brief Width
* @details This Variable Contains the Width of the Screen
*/
int width;
/**
* @brief Height
* @details This Variable Contains the Height of the Screen
*/
int height;
/**
* @struct STRUCT_SCREEN_CENTER
* @brief Screen Center Structure
* @details This Structure Contains the Screen Center Properties as Follows:
* @param x X Center
* @param y Y Center
*/
struct STRUCT_SCREEN_CENTER {
/**
* @brief X Center
* @details This Variable Contains the X Center of the Screen
*/
int x;
/**
* @brief Y Center
* @details This Variable Contains the Y Center of the Screen
*/
int y;
} center;
} screen;
/**
* @brief Mouse State
* @details This Variable Contains the State of the Mouse
*
* @note Mouse State Must be ENUM_MOUSE_STATE
*
* @see ENUM_MOUSE_STATE
*/
ENUM_MOUSE_STATE mouseState;
public:
/**
* @struct STRUCT_WINDOWS
* @brief Graphics Windows Structure
* @details This Structure Contains the Windows Properties as Follows:
* @param main Main Window
* @param info Info Window
*/
struct STRUCT_WINDOWS {
/**
* @struct STRUCT_MAIN_WINDOW
* @brief Main Window Structure
* @details This Structure Contains the Main Window Properties as Follows:
*/
struct STRUCT_MAIN_WINDOW {
/**
* @brief Matrix
* @details This Variable Contains the Matrix of the Main Window
*
* @note Matrix Must be cv::Mat
*/
cv::Mat matrix;
/**
* @struct STRUCT_MAIN_WINDOW_POSITION
* @brief Main Window Position Structure
* @details This Structure Contains the Main Window Position Properties as Follows:
* @param x X Position
* @param y Y Position
*/
struct STRUCT_MAIN_WINDOW_POSITION {
/**
* @brief X Position
* @details This Variable Contains the X Position of the Main Window
*/
int x;
/**
* @brief Y Position
* @details This Variable Contains the Y Position of the Main Window
*/
int y;
} position;
} main;
/**
* @struct STRUCT_INFO_WINDOW
* @brief Info Window Structure
* @details This Structure Contains the Info Window Properties as Follows:
*/
struct STRUCT_INFO_WINDOW {
/**
* @brief Matrix
* @details This Variable Contains the Matrix of the Info Window
*
* @note Matrix Must be cv::Mat
*/
cv::Mat matrix;
/**
* @struct STRUCT_INFO_WINDOW_POSITION
* @brief Info Window Position Structure
* @details This Structure Contains the Info Window Position Properties as Follows:
* @param x X Position
* @param y Y Position
*/
struct STRUCT_INFO_WINDOW_POSITION {
/**
* @brief X Position
* @details This Variable Contains the X Position of the Info Window
*/
int x;
/**
* @brief Y Position
* @details This Variable Contains the Y Position of the Info Window
*/
int y;
} position;
} info;
/**
* @struct STRUCT_TEMP_WINDOWS
* @brief Temp Windows Structure
* @details This Structure Contains the Temporary Windows Properties as Follows:
* @param temp1 Temp Window 1
* @param temp2 Temp Window 2
* @param temp3 Temp Window 3
* @param temp4 Temp Window 4
* @param temp5 Temp Window 5
*/
struct STRUCT_TEMP_WINDOW {
/**
* @brief Matrix
* @details This Variable Contains the Matrix of the Temp Window
*
* @note Matrix Must be cv::Mat
*/
cv::Mat matrix;
/**
* @struct STRUCT_TEMP_WINDOW_POSITION
* @brief Temp Window Position Structure
* @details This Structure Contains the Temp Window Position Properties as Follows:
* @param x X Position
* @param y Y Position
*/
struct STRUCT_TEMP_WINDOW_POSITION {
/**
* @brief X Position
* @details This Variable Contains the X Position of the Temp Window
*/
int x;
/**
* @brief Y Position
* @details This Variable Contains the Y Position of the Temp Window
*/
int y;
} position;
} temp1, temp2, temp3, temp4, temp5;
} windows;
/**
* @brief 2D Points Instance
* @details This Variable Contains the 2D Points Instance
*
* @note 2D Points Instance Must be std::vector<env::Point2D>
*/
std::vector<env::Point2D> points2D;
/**
* @brief 3D Points Instance
* @details This Variable Contains the 3D Points Instance
*
* @note 3D Points Instance Must be std::vector<env::Point3D>
*/
std::vector<env::Point3D> points3D;
/**
* @brief 2D Boxes Instance
* @details This Variable Contains the 2D Boxes Instance
*
* @note 2D Boxes Instance Must be std::vector<env::Box2D>
*/
std::vector<std::vector<env::Box2D>> boxes2D;
/**
* @brief 3D Boxes Instance
* @details This Variable Contains the 3D Boxes Instance
*
* @note 3D Boxes Instance Must be std::vector<env::Box3D>
*/
std::vector<env::Box3D> boxes3D;
/**
* @brief Constructor with Parameters
* @details This Constructor Initializes the Graphics with Given Parameters
*
* @param _environment Environment
*/
Graphics(
ENUM_ALGORITHM_ENVIRONMENT _environment = ENVIRONMENT_2D
);
/**
* @brief Destructor
* @details This Destructor Destroys the Graphics
*/
~Graphics();
/**
* @brief Method to Generate Info Window GUI
* @details This Method Generates the Info Window GUI
*/
void generateInfoWindow();
/**
* @brief Mouse Callback Method
* @details This Method is the Callback Method for Mouse Events
*
* @param event Event
* @param x X - Axis Coordinate
* @param y Y - Axis Coordinate
* @param flags Flags
* @param userdata User Data
*/
static void onMouseCallback(int event, int x, int y, int flags, void* userdata);
/**
* @brief Mouse Events Method
* @details This Method Handles the Mouse Events
*
* @param event Event
* @param x X - Axis Coordinate
* @param y Y - Axis Coordinate
* @param flags Flags
*/
void onMouse(int event, int x, int y, int flags);
/**
* @brief Method to Draw Point
* @details This Method Draws a Point on the Screen
*
* @param point Point
* @param add_to_points Add to Points
* @param show_flag Show Flag
* @param method Method
* @param window_mode Window Mode
*/
void drawPoint(
env::Point2D point,
bool add_to_points,
bool show_flag,
ENUM_SHOW_POINT_METHODS show_method,
ENUM_SHOW_WINDOW_MODE window_method,
std::string info
);
/**
* @brief Method to Draw Line
* @details This Method Draws a Line on the Screen
*
* @param point1 Point 1
* @param point2 Point 2
* @param color Color
* @param thickness Thickness
* @param add_to_lines Add to Lines
* @param show_flag Show Flag
* @param show_method Show Method
* @param window_method Window Method
* @param weight Line Weight
*/
void drawLine(
env::Point2D point1,
env::Point2D point2,
std::string weight,
cv::Scalar color,
int thickness,
bool add_to_lines,
bool show_flag,
ENUM_SHOW_LINE_METHODS show_method,
ENUM_SHOW_WINDOW_MODE window_method
);
/**
* @brief Method to Draw Box