Lane and Object Detection
Using OpenCV and YOLOv7
Loading...
Searching...
No Matches
Globals.hpp
1#pragma once
2
3#include <array>
4#include <chrono>
5#include <cmath>
6#include <cstdint>
7#include <exception>
8#include <map>
9#include <string>
10#include <unordered_map>
11
12#include <opencv2/core/cvdef.h>
13#include <opencv2/core/types.hpp>
14#include <opencv2/imgproc.hpp>
15
21{
26 namespace Exceptions
27 {
31 class NotImplementedError : public std::exception
32 {
33 };
34
38 class SQLiteDatabaseError : public std::exception
39 {
40 };
41 }
42
49 static inline std::string GetTimeElapsed(const std::chrono::time_point<std::chrono::high_resolution_clock>& p_startTime)
50 {
51 const double MINUTES_IN_HOUR = 60;
52 const double SECONDS_IN_HOUR = 3600;
53 const double SECONDS_IN_MINUTE = 60;
54 const uint32_t PADDING_THRESHOLD = 10;
55
56 const uint32_t TOTAL_TIME_IN_SECONDS = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() - p_startTime).count();
57
58 const double TOTAL_HOURS = TOTAL_TIME_IN_SECONDS / SECONDS_IN_HOUR;
59 const double TOTAL_MINUTES = (TOTAL_HOURS - std::floor(TOTAL_HOURS)) * MINUTES_IN_HOUR;
60 const double TOTAL_SECONDS = (TOTAL_MINUTES - std::floor(TOTAL_MINUTES)) * SECONDS_IN_MINUTE;
61
62 const uint32_t HOURS = std::floor(TOTAL_HOURS);
63 const uint32_t MINUTES = std::floor(TOTAL_MINUTES);
64 const uint32_t SECONDS = std::floor(TOTAL_SECONDS);
65
66 std::string output;
67
68 if (HOURS < PADDING_THRESHOLD)
69 {
70 output += "0";
71 }
72
73 output += std::to_string(HOURS);
74 output += ":";
75
76 if (MINUTES < PADDING_THRESHOLD)
77 {
78 output += "0";
79 }
80
81 output += std::to_string(MINUTES);
82 output += ":";
83
84 if (SECONDS < PADDING_THRESHOLD)
85 {
86 output += "0";
87 }
88
89 output += std::to_string(SECONDS);
90
91 return output;
92 }
93
97 static inline const std::string G_CLI_HELP_MESSAGE = "\nUsage: lane-and-object-detection --input ... --yolo-folder-path ... [optional]\n\nOPTIONS:\n\nGeneric Options:\n\n -h --help Display available options\n\nRequired Options:\n\n -i --input File path or camera ID\n -y --yolo-folder-path Path to the yolo folder\n\nOptional options:\n\n -o --object-detector-type One of: none, standard or tiny (default = none)\n -b --object-detector-backend One of: cpu, gpu or cuda (default = cpu)\n -s --object-detector-blob-size One of: 208, 320, 416, 512 or 608 (default = 208)\n\n";
98
103 static inline const uint32_t G_VIDEO_INPUT_HEIGHT = 1080;
104 static inline const uint32_t G_VIDEO_INPUT_WIDTH = 1920;
106
111 static inline const uint32_t G_VIDEO_OUTPUT_HEIGHT = 1080;
112 static inline const uint32_t G_VIDEO_OUTPUT_WIDTH = 1920;
114
118 static inline const uint32_t G_VIDEO_OUTPUT_FPS = 30;
119
124 static inline const uint32_t G_KEY_DEBUG_MODE = 'd';
125 static inline const uint32_t G_KEY_TOGGLE_SAVE_OUTPUT = 'r';
126 static inline const uint32_t G_KEY_QUIT = 'q';
128
133 static inline const uint32_t G_FONT_DEFAULT_FACE = cv::FONT_HERSHEY_DUPLEX;
134 static inline const uint32_t G_FONT_DEFAULT_THICKNESS = 1;
135 static inline const int32_t G_FONT_DEFAULT_HORIZONTAL_PADDING = 10;
136 static inline const int32_t G_FONT_DEFAULT_VERTICAL_PADDING = 15;
137 static inline const double G_FONT_DEFAULT_DECREMENT = 0.1;
138 static inline const double G_FONT_DEFAULT_SCALE = 1;
140
145 static inline const cv::Scalar G_COLOUR_BLACK = cv::Scalar(0, 0, 0);
146 static inline const cv::Scalar G_COLOUR_GREY = cv::Scalar(128, 128, 128);
147 static inline const cv::Scalar G_COLOUR_WHITE = cv::Scalar(255, 255, 255);
148 static inline const cv::Scalar G_COLOUR_RED = cv::Scalar(0, 0, 192);
149 static inline const cv::Scalar G_COLOUR_LIGHT_RED = cv::Scalar(128, 128, 192);
150 static inline const cv::Scalar G_COLOUR_ORANGE = cv::Scalar(0, 128, 192);
151 static inline const cv::Scalar G_COLOUR_YELLOW = cv::Scalar(0, 192, 192);
152 static inline const cv::Scalar G_COLOUR_GREEN = cv::Scalar(0, 192, 0);
153 static inline const cv::Scalar G_COLOUR_BLUE = cv::Scalar(192, 0, 0);
154 static inline const cv::Scalar G_COLOUR_LIGHT_BLUE = cv::Scalar(192, 128, 128);
155 static inline const cv::Scalar G_COLOUR_PURPLE = cv::Scalar(192, 0, 192);
157
161 static inline const std::string G_TIME_UNIT = "us";
162
166 static inline const double G_MICROSECONDS_IN_SECOND = 1000000;
167
171 static inline const uint32_t G_CONVERT_DECIMAL_TO_PERCENTAGE = 100;
172
176 static inline const double G_DIVIDE_BY_TWO = 2;
177
182 static inline const std::string G_UI_TEXT_RECORDING = "Output Recording Enabled";
183 static inline const std::string G_UI_TEXT_NOT_RECORDING = "Press 'r' to record output";
185
190 static inline const std::string G_UI_TEXT_DEBUG_MODE = "Debug Mode Enabled";
191 static inline const std::string G_UI_TEXT_NOT_DEBUG_MODE = "Press 'd' to enter debug mode";
193
198 static inline const double G_UI_H1_FONT_SCALE = 0.6;
199 static inline const double G_UI_H2_FONT_SCALE = 0.4;
201
206 static inline const int32_t G_UI_BOTTOM_BAR_HEIGHT = 55;
207 static inline const int32_t G_UI_TITLE_HEIGHT = 30;
208 static inline const int32_t G_UI_SUBTITLE_HEIGHT = 25;
210
215
219 static inline const cv::Rect G_UI_RECT_FPS = cv::Rect(300, G_VIDEO_INPUT_HEIGHT - G_UI_BOTTOM_BAR_HEIGHT, 300, G_UI_BOTTOM_BAR_HEIGHT);
220
225
230
235
242 static inline const cv::Point G_UI_POINT_RECORDING_DOT = cv::Point(G_VIDEO_INPUT_WIDTH - 190, G_VIDEO_INPUT_HEIGHT - 13);
243 static inline const uint32_t G_UI_RADIUS_RECORDING_DOT = 5;
246
250 static inline const int32_t G_HOUGH_LINE_THICKNESS = 2;
251
255 static inline const cv::Scalar G_LANE_OVERLAY_COLOUR = cv::Scalar(0, 64, 0);
256
260 static inline const uint32_t G_DEFAULT_ROLLING_AVERAGE_SIZE = 10;
261
266 static inline const int32_t G_ROI_TOP_HEIGHT = 800;
267 static inline const int32_t G_ROI_BOTTOM_HEIGHT = 1025;
268 static inline const int32_t G_ROI_TOP_WIDTH = 250;
269 static inline const int32_t G_ROI_BOTTOM_WIDTH = 850;
271
286 static inline const uint32_t G_NUMBER_OF_POINTS = 4;
287 static inline const std::array<cv::Point, G_NUMBER_OF_POINTS> G_ROI_MASK_POINTS = {
288 cv::Point((G_VIDEO_INPUT_WIDTH / 2.0) - (G_ROI_TOP_WIDTH / 2.0), G_ROI_TOP_HEIGHT),
289 cv::Point((G_VIDEO_INPUT_WIDTH / 2.0) + (G_ROI_TOP_WIDTH / 2.0), G_ROI_TOP_HEIGHT),
290 cv::Point((G_VIDEO_INPUT_WIDTH / 2.0) + (G_ROI_BOTTOM_WIDTH / 2.0), G_ROI_BOTTOM_HEIGHT),
291 cv::Point((G_VIDEO_INPUT_WIDTH / 2.0) - (G_ROI_BOTTOM_WIDTH / 2.0), G_ROI_BOTTOM_HEIGHT),
292 };
293
294
310 static inline const uint32_t G_ROI_BOUND_BOX_PADDING = 10;
318
322 static inline const double G_DEBUGGING_FRAME_SCALING_FACTOR = static_cast<double>(G_VIDEO_INPUT_WIDTH / 3.0) / static_cast<double>(G_ROI_BOUNDING_BOX_END_X - G_ROI_BOUNDING_BOX_START_X);
323
328 static inline const uint32_t G_ROI_TOP_LEFT_INDEX = 0;
329 static inline const uint32_t G_ROI_TOP_RIGHT_INDEX = 1;
330 static inline const uint32_t G_ROI_BOTTOM_RIGHT_INDEX = 2;
331 static inline const uint32_t G_ROI_BOTTOM_LEFT_INDEX = 3;
333
354
357
361
364
368
373 static inline const uint32_t G_CANNY_ALGORITHM_LOWER_THRESHOLD = 128;
374 static inline const uint32_t G_CANNY_ALGORITHM_UPPER_THRESHOLD = 255;
376
381 static inline const double G_HOUGH_RHO = 1;
382 static inline const double G_HOUGH_THETA = CV_PI / 180.0;
383 static inline const uint32_t G_HOUGH_THRESHOLD = 32;
384 static inline const uint32_t G_HOUGH_MIN_LINE_LENGTH = 8;
385 static inline const uint32_t G_HOUGH_MAX_LINE_GAP = 8;
387
392 static inline const uint32_t G_VEC4_X1_INDEX = 0;
393 static inline const uint32_t G_VEC4_Y1_INDEX = 1;
394 static inline const uint32_t G_VEC4_X2_INDEX = 2;
395 static inline const uint32_t G_VEC4_Y2_INDEX = 3;
397
401 static inline const double G_HOUGH_LINE_HORIZONTAL_GRADIENT_THRESHOLD = 0.5;
402
406 static inline const uint32_t G_SOLID_LINE_LENGTH_THRESHOLD = 175;
407
411 enum class DrivingState : std::uint8_t
412 {
413 WITHIN_LANE = 0,
414 CHANGING_LANES,
415 ONLY_LEFT_LANE_MARKING_DETECTED,
416 ONLY_RIGHT_LANE_MARKING_DETECTED,
417 NO_LANE_MARKINGS_DETECTED
418 };
419
423 static inline const std::unordered_map<DrivingState, std::string> G_DRIVING_STATE_TITLES = {
424 {DrivingState::WITHIN_LANE, "Within Lanes" },
425 {DrivingState::CHANGING_LANES, "WARNING: Changing lanes" },
426 {DrivingState::ONLY_LEFT_LANE_MARKING_DETECTED, "WARNING: Only left road marking detected" },
427 {DrivingState::ONLY_RIGHT_LANE_MARKING_DETECTED, "WARNING: Only right road marking detected"},
428 {DrivingState::NO_LANE_MARKINGS_DETECTED, "WARNING: No road markings detected" },
429 };
430
435
439 static inline const std::string G_YOLO_NAME = "YOLOv7";
440
445 enum class ObjectDetectorTypes : std::uint8_t
446 {
447 NONE = 0,
448 TINY,
449 STANDARD
450 };
451
457 enum class ObjectDetectorBackEnds : std::uint8_t
458 {
459 NONE = 0,
460 CPU,
461 GPU,
462 CUDA
463 };
464
469 enum class ObjectDetectorBlobSizes : std::int16_t
470 {
471 NONE = 0,
472 ONE = 288,
473 TWO = 320,
474 THREE = 416,
475 FOUR = 512,
476 FIVE = 608
477 };
478
483 static inline const double G_OBJECT_DETECTOR_SCALE_FACTOR = 1 / 255.0;
484 static inline const double G_OBJECT_DETECTOR_CONFIDENCE_THRESHOLD = 0.4;
485 static inline const double G_OBJECT_DETECTOR_NMS_THRESHOLD = 0.4;
487
492 static inline const uint32_t G_OBJECT_DETECTOR_BOUNDING_BOX_BUFFER = 5;
493 static inline const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_HEADER_HEIGHT = 15;
494 static inline const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_BORDER_THICKNESS = 1;
495 static inline const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_CHARACTER_WIDTH = 9;
497 static inline const double G_OBJECT_DETECTOR_BOUNDING_BOX_FONT_SCALE = 0.5;
499
506 static inline const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_WIDTH_INDEX = 2;
507 static inline const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_HEIGHT_INDEX = 3;
510
515 static inline const uint32_t G_OBJECT_DETECTOR_NUMBER_OF_DETECTABLE_OBJECTS = 80;
516 static inline const std::array<std::string, G_OBJECT_DETECTOR_NUMBER_OF_DETECTABLE_OBJECTS> G_OBJECT_DETECTOR_OBJECT_NAMES = {
517 "person",
518 "bicycle",
519 "car",
520 "motorbike",
521 "aeroplane",
522 "bus",
523 "train",
524 "truck",
525 "boat",
526 "traffic light",
527 "fire hydrant",
528 "stop sign",
529 "parking meter",
530 "bench",
531 "bird",
532 "cat",
533 "dog",
534 "horse",
535 "sheep",
536 "cow",
537 "elephant",
538 "bear",
539 "zebra",
540 "giraffe",
541 "backpack",
542 "umbrella",
543 "handbag",
544 "tie",
545 "suitcase",
546 "frisbee",
547 "skis",
548 "snowboard",
549 "sports ball",
550 "kite",
551 "baseball bat",
552 "baseball glove",
553 "skateboard",
554 "surfboard",
555 "tennis racket",
556 "bottle",
557 "wine glass",
558 "cup",
559 "fork",
560 "knife",
561 "spoon",
562 "bowl",
563 "banana",
564 "apple",
565 "sandwich",
566 "orange",
567 "broccoli",
568 "carrot",
569 "hot dog",
570 "pizza",
571 "donut",
572 "cake",
573 "chair",
574 "sofa",
575 "pottedplant",
576 "bed",
577 "diningtable",
578 "toilet",
579 "tvmonitor",
580 "laptop",
581 "mouse",
582 "remote",
583 "keyboard",
584 "cell phone",
585 "microwave",
586 "oven",
587 "toaster",
588 "sink",
589 "refrigerator",
590 "book",
591 "clock",
592 "vase",
593 "scissors",
594 "teddy bear",
595 "hair drier",
596 "toothbrush",
597 };
598
599
604 static inline const std::map<std::string, cv::Scalar> G_OBJECT_DETECTOR_OBJECT_NAMES_AND_COLOURS = {
605 {"aeroplane", G_COLOUR_WHITE },
606 {"apple", G_COLOUR_WHITE },
607 {"backpack", G_COLOUR_WHITE },
608 {"banana", G_COLOUR_WHITE },
609 {"baseball bat", G_COLOUR_WHITE },
610 {"baseball glove", G_COLOUR_WHITE },
611 {"bear", G_COLOUR_WHITE },
612 {"bed", G_COLOUR_WHITE },
613 {"bench", G_COLOUR_WHITE },
614 {"bicycle", G_COLOUR_ORANGE},
615 {"bird", G_COLOUR_WHITE },
616 {"boat", G_COLOUR_WHITE },
617 {"book", G_COLOUR_WHITE },
618 {"bottle", G_COLOUR_WHITE },
619 {"bowl", G_COLOUR_WHITE },
620 {"broccoli", G_COLOUR_WHITE },
621 {"bus", G_COLOUR_GREY },
622 {"cake", G_COLOUR_WHITE },
623 {"car", G_COLOUR_YELLOW},
624 {"carrot", G_COLOUR_WHITE },
625 {"cat", G_COLOUR_WHITE },
626 {"cell phone", G_COLOUR_WHITE },
627 {"chair", G_COLOUR_WHITE },
628 {"clock", G_COLOUR_WHITE },
629 {"cow", G_COLOUR_WHITE },
630 {"cup", G_COLOUR_WHITE },
631 {"diningtable", G_COLOUR_WHITE },
632 {"dog", G_COLOUR_WHITE },
633 {"donut", G_COLOUR_WHITE },
634 {"elephant", G_COLOUR_WHITE },
635 {"fire hydrant", G_COLOUR_WHITE },
636 {"fork", G_COLOUR_WHITE },
637 {"frisbee", G_COLOUR_WHITE },
638 {"giraffe", G_COLOUR_WHITE },
639 {"hair drier", G_COLOUR_WHITE },
640 {"handbag", G_COLOUR_WHITE },
641 {"horse", G_COLOUR_WHITE },
642 {"hot dog", G_COLOUR_WHITE },
643 {"keyboard", G_COLOUR_WHITE },
644 {"kite", G_COLOUR_WHITE },
645 {"knife", G_COLOUR_WHITE },
646 {"laptop", G_COLOUR_WHITE },
647 {"microwave", G_COLOUR_WHITE },
648 {"motorbike", G_COLOUR_GREEN },
649 {"mouse", G_COLOUR_WHITE },
650 {"orange", G_COLOUR_WHITE },
651 {"oven", G_COLOUR_WHITE },
652 {"parking meter", G_COLOUR_WHITE },
653 {"person", G_COLOUR_BLUE },
654 {"pizza", G_COLOUR_WHITE },
655 {"pottedplant", G_COLOUR_WHITE },
656 {"refrigerator", G_COLOUR_WHITE },
657 {"remote", G_COLOUR_WHITE },
658 {"sandwich", G_COLOUR_WHITE },
659 {"scissors", G_COLOUR_WHITE },
660 {"sheep", G_COLOUR_WHITE },
661 {"sink", G_COLOUR_WHITE },
662 {"skateboard", G_COLOUR_WHITE },
663 {"skis", G_COLOUR_WHITE },
664 {"snowboard", G_COLOUR_WHITE },
665 {"sofa", G_COLOUR_WHITE },
666 {"spoon", G_COLOUR_WHITE },
667 {"sports ball", G_COLOUR_WHITE },
668 {"stop sign", G_COLOUR_WHITE },
669 {"suitcase", G_COLOUR_WHITE },
670 {"surfboard", G_COLOUR_WHITE },
671 {"teddy bear", G_COLOUR_WHITE },
672 {"tennis racket", G_COLOUR_WHITE },
673 {"tie", G_COLOUR_WHITE },
674 {"toaster", G_COLOUR_WHITE },
675 {"toilet", G_COLOUR_WHITE },
676 {"toothbrush", G_COLOUR_WHITE },
677 {"traffic light", G_COLOUR_RED },
678 {"train", G_COLOUR_WHITE },
679 {"truck", G_COLOUR_PURPLE},
680 {"tvmonitor", G_COLOUR_WHITE },
681 {"umbrella", G_COLOUR_WHITE },
682 {"vase", G_COLOUR_WHITE },
683 {"wine glass", G_COLOUR_WHITE },
684 {"zebra", G_COLOUR_WHITE },
685 };
686
690 static inline const std::string G_PERFORMANCE_TESTS_CLI_HELP_MESSAGE = "Usage: lane-and-object-detection-performance-tests --platform ... --database-path ... --input ... --yolo-folder-path ... --repetitions ...\n\nOPTIONS:\n\nGeneric Options:\n\n-h --help Display available options\n\nRequired Options:\n\n-p --platform The current platform being tested\n-d --database-path Path to SQLite database file\n-i --input Benchmark video file path\n-y --yolo-folder-path Path to the yolo configuration folder\n-r --repetitions Number of repetitions for each test";
691
696 static inline const uint32_t G_PERFORMANCE_TESTS_NUMBER_OF_TESTS = 21;
697
698 static inline const std::array<std::string, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS> G_PERFORMANCE_TESTS_NAMES = {
699 "No YOLO",
700 "YOLO-tiny 288 (CPU)",
701 "YOLO-tiny 288 (GPU)",
702 "YOLO 288 (CPU)",
703 "YOLO 288 (GPU)",
704 "YOLO-tiny 320 (CPU)",
705 "YOLO-tiny 320 (GPU)",
706 "YOLO 320 (CPU)",
707 "YOLO 320 (GPU)",
708 "YOLO-tiny 416 (CPU)",
709 "YOLO-tiny 416 (GPU)",
710 "YOLO 416 (CPU)",
711 "YOLO 416 (GPU)",
712 "YOLO-tiny 512 (CPU)",
713 "YOLO-tiny 512 (GPU)",
714 "YOLO 512 (CPU)",
715 "YOLO 512 (GPU)",
716 "YOLO-tiny 608 (CPU)",
717 "YOLO-tiny 608 (GPU)",
718 "YOLO 608 (CPU)",
719 "YOLO 608 (GPU)",
720 };
721
722 static inline const std::array<ObjectDetectorTypes, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS> G_PERFORMANCE_TESTS_OBJECT_DETECTOR_TYPES = {
723 ObjectDetectorTypes::NONE,
724 ObjectDetectorTypes::TINY,
725 ObjectDetectorTypes::TINY,
726 ObjectDetectorTypes::STANDARD,
727 ObjectDetectorTypes::STANDARD,
728 ObjectDetectorTypes::TINY,
729 ObjectDetectorTypes::TINY,
730 ObjectDetectorTypes::STANDARD,
731 ObjectDetectorTypes::STANDARD,
732 ObjectDetectorTypes::TINY,
733 ObjectDetectorTypes::TINY,
734 ObjectDetectorTypes::STANDARD,
735 ObjectDetectorTypes::STANDARD,
736 ObjectDetectorTypes::TINY,
737 ObjectDetectorTypes::TINY,
738 ObjectDetectorTypes::STANDARD,
739 ObjectDetectorTypes::STANDARD,
740 ObjectDetectorTypes::TINY,
741 ObjectDetectorTypes::TINY,
742 ObjectDetectorTypes::STANDARD,
743 ObjectDetectorTypes::STANDARD,
744 };
745
746 static inline const std::array<ObjectDetectorBackEnds, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS> G_PERFORMANCE_TESTS_BACK_END_TYPES = {
747 ObjectDetectorBackEnds::NONE,
748 ObjectDetectorBackEnds::CPU,
749 ObjectDetectorBackEnds::GPU,
750 ObjectDetectorBackEnds::CPU,
751 ObjectDetectorBackEnds::GPU,
752 ObjectDetectorBackEnds::CPU,
753 ObjectDetectorBackEnds::GPU,
754 ObjectDetectorBackEnds::CPU,
755 ObjectDetectorBackEnds::GPU,
756 ObjectDetectorBackEnds::CPU,
757 ObjectDetectorBackEnds::GPU,
758 ObjectDetectorBackEnds::CPU,
759 ObjectDetectorBackEnds::GPU,
760 ObjectDetectorBackEnds::CPU,
761 ObjectDetectorBackEnds::GPU,
762 ObjectDetectorBackEnds::CPU,
763 ObjectDetectorBackEnds::GPU,
764 ObjectDetectorBackEnds::CPU,
765 ObjectDetectorBackEnds::GPU,
766 ObjectDetectorBackEnds::CPU,
767 ObjectDetectorBackEnds::GPU,
768 };
769
770 static inline const std::array<ObjectDetectorBlobSizes, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS> G_PERFORMANCE_TESTS_BLOB_SIZES = {
771 ObjectDetectorBlobSizes::NONE,
772 ObjectDetectorBlobSizes::ONE,
773 ObjectDetectorBlobSizes::ONE,
774 ObjectDetectorBlobSizes::ONE,
775 ObjectDetectorBlobSizes::ONE,
776 ObjectDetectorBlobSizes::TWO,
777 ObjectDetectorBlobSizes::TWO,
778 ObjectDetectorBlobSizes::TWO,
779 ObjectDetectorBlobSizes::TWO,
780 ObjectDetectorBlobSizes::THREE,
781 ObjectDetectorBlobSizes::THREE,
782 ObjectDetectorBlobSizes::THREE,
783 ObjectDetectorBlobSizes::THREE,
784 ObjectDetectorBlobSizes::FOUR,
785 ObjectDetectorBlobSizes::FOUR,
786 ObjectDetectorBlobSizes::FOUR,
787 ObjectDetectorBlobSizes::FOUR,
788 ObjectDetectorBlobSizes::FIVE,
789 ObjectDetectorBlobSizes::FIVE,
790 ObjectDetectorBlobSizes::FIVE,
791 ObjectDetectorBlobSizes::FIVE,
792 };
793
794}
Used for functionality that has not been implemented.
Definition Globals.hpp:32
Contains all custom exceptions.
Contains all global and constant objects.
static const uint32_t G_KEY_QUIT
Keyboard values when getting user input.
Definition Globals.hpp:126
static const double G_MICROSECONDS_IN_SECOND
Conversion between time units.
Definition Globals.hpp:166
static const uint32_t G_SOLID_LINE_LENGTH_THRESHOLD
Threshold length to decide whether a line is to be considered solid line road marking.
Definition Globals.hpp:406
static const uint32_t G_UI_RADIUS_RECORDING_DOT
Recording status UI locations.
Definition Globals.hpp:243
static const std::unordered_map< DrivingState, std::string > G_DRIVING_STATE_TITLES
The driving state titles to display.
Definition Globals.hpp:423
static const uint32_t G_CHANGING_LANES_DISTANCE_DIFFERENCE_FRAME_COUNT_THRESHOLD
The number of frames to wait before calculating another distance difference while the vehicle is chan...
Definition Globals.hpp:434
static const cv::Scalar G_COLOUR_LIGHT_BLUE
OpenCV Colours (in BGR format).
Definition Globals.hpp:154
static const double G_UI_H1_FONT_SCALE
Font scales for different heading sizes.
Definition Globals.hpp:198
static const double G_TOP_MID_POINT_X_LOCATION
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:358
static const uint32_t G_VIDEO_OUTPUT_FPS
Output video FPS.
Definition Globals.hpp:118
static const cv::Range G_ROI_BOUNDING_BOX_Y_RANGE
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:316
static const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_HEADER_HEIGHT
Object detection bounding box properties.
Definition Globals.hpp:493
static const uint32_t G_ROI_TOP_RIGHT_INDEX
The index values which represent each corner of G_ROI_MASK_POINTS.
Definition Globals.hpp:329
static const uint32_t G_FONT_DEFAULT_THICKNESS
Font settings.
Definition Globals.hpp:134
static const uint32_t G_ROI_BOUND_BOX_PADDING
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:310
static const std::string G_UI_TEXT_RECORDING
Text to display whether or not recording.
Definition Globals.hpp:182
static const cv::Scalar G_COLOUR_BLACK
OpenCV Colours (in BGR format).
Definition Globals.hpp:145
static const uint32_t G_VIDEO_OUTPUT_WIDTH
Output video dimensions.
Definition Globals.hpp:112
static const cv::Rect G_UI_RECT_DRIVING_STATE_SUBTITLE
Driving state sub-title UI location (width is the entire screen for centering).
Definition Globals.hpp:229
static const cv::Rect G_UI_RECT_RECORDING_ELAPSED_TIME
Recording status UI locations.
Definition Globals.hpp:241
static const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_CENTER_Y_COORD_INDEX
The indicies representing various values in the output blobs.
Definition Globals.hpp:505
static const uint32_t G_OBJECT_DETECTOR_BOUNDING_BOX_BUFFER
Object detection bounding box properties.
Definition Globals.hpp:492
static const double G_RIGHT_LINE_THRESHOLD_M
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:365
static const uint32_t G_KEY_DEBUG_MODE
Keyboard values when getting user input.
Definition Globals.hpp:124
static const uint32_t G_HOUGH_MIN_LINE_LENGTH
Hough transform threshold and properties.
Definition Globals.hpp:384
static const std::array< ObjectDetectorBlobSizes, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS > G_PERFORMANCE_TESTS_BLOB_SIZES
Performance tests settings.
Definition Globals.hpp:770
static const uint32_t G_VIDEO_INPUT_HEIGHT
Input video dimensions.
Definition Globals.hpp:103
static const uint32_t G_VIDEO_INPUT_WIDTH
Input video dimensions.
Definition Globals.hpp:104
static const double G_OBJECT_DETECTOR_CONFIDENCE_THRESHOLD
Object detection threshold and properties.
Definition Globals.hpp:484
static const std::string G_UI_TEXT_DEBUG_MODE
Text to display whether or not in debug mode.
Definition Globals.hpp:190
static const cv::Rect G_UI_RECT_FPS
Performance-related information UI location.
Definition Globals.hpp:219
static const double G_OBJECT_DETECTOR_NMS_THRESHOLD
Object detection threshold and properties.
Definition Globals.hpp:485
static const double G_RIGHT_LINE_THRESHOLD_C
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:366
static const int32_t G_ROI_TOP_HEIGHT
Region-of-interest dimensions.
Definition Globals.hpp:266
static const int32_t G_ROI_BOTTOM_WIDTH
Region-of-interest dimensions.
Definition Globals.hpp:269
static const double G_DIVIDE_BY_TWO
Divide by two.
Definition Globals.hpp:176
static const uint32_t G_ROI_BOUNDING_BOX_START_Y
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:313
static const cv::Scalar G_COLOUR_GREY
OpenCV Colours (in BGR format).
Definition Globals.hpp:146
static const cv::Rect G_UI_RECT_DRIVING_STATE
Driving state UI location (width is the entire screen for centering).
Definition Globals.hpp:224
static const std::string G_PERFORMANCE_TESTS_CLI_HELP_MESSAGE
CLI help message for the performance tests.
Definition Globals.hpp:690
static const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_HEIGHT_INDEX
The indicies representing various values in the output blobs.
Definition Globals.hpp:507
static const uint32_t G_ROI_BOUNDING_BOX_START_X
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:311
static const uint32_t G_VEC4_X1_INDEX
Hough line index mapping.
Definition Globals.hpp:392
static const cv::Range G_ROI_BOUNDING_BOX_X_RANGE
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:315
static const uint32_t G_VIDEO_OUTPUT_HEIGHT
Output video dimensions.
Definition Globals.hpp:111
static const int32_t G_HOUGH_LINE_THICKNESS
The thickness of the hough lines drawn in debug mode.
Definition Globals.hpp:250
static const cv::Scalar G_COLOUR_GREEN
OpenCV Colours (in BGR format).
Definition Globals.hpp:152
static const uint32_t G_VEC4_X2_INDEX
Hough line index mapping.
Definition Globals.hpp:394
static const cv::Scalar G_COLOUR_WHITE
OpenCV Colours (in BGR format).
Definition Globals.hpp:147
static const uint32_t G_VEC4_Y1_INDEX
Hough line index mapping.
Definition Globals.hpp:393
static const double G_DEBUGGING_FRAME_SCALING_FACTOR
Scaling factor for debugging frames.
Definition Globals.hpp:322
static const std::array< std::string, G_OBJECT_DETECTOR_NUMBER_OF_DETECTABLE_OBJECTS > G_OBJECT_DETECTOR_OBJECT_NAMES
Names of detectable objects. The order is significant and should not be changed.
Definition Globals.hpp:516
static const int32_t G_ROI_BOTTOM_HEIGHT
Region-of-interest dimensions.
Definition Globals.hpp:267
static const uint32_t G_ROI_BOTTOM_RIGHT_INDEX
The index values which represent each corner of G_ROI_MASK_POINTS.
Definition Globals.hpp:330
static const uint32_t G_OBJECT_DETECTOR_NUMBER_OF_DETECTABLE_OBJECTS
Names of detectable objects. The order is significant and should not be changed.
Definition Globals.hpp:515
static const double G_BOTTOM_TWO_THIRD_LOCATION
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:360
static const uint32_t G_HOUGH_MAX_LINE_GAP
Hough transform threshold and properties.
Definition Globals.hpp:385
static const double G_UI_H2_FONT_SCALE
Font scales for different heading sizes.
Definition Globals.hpp:199
static const std::string G_YOLO_NAME
The name of the YOLO version being used.
Definition Globals.hpp:439
static const double G_OBJECT_DETECTOR_BOUNDING_BOX_FONT_SCALE
Object detection bounding box properties.
Definition Globals.hpp:497
static const int32_t G_FONT_DEFAULT_VERTICAL_PADDING
Font settings.
Definition Globals.hpp:136
static const int32_t G_FONT_DEFAULT_HORIZONTAL_PADDING
Font settings.
Definition Globals.hpp:135
ObjectDetectorTypes
The type of object detector to use with an option to disable object detection. The tiny version is mo...
Definition Globals.hpp:446
static const double G_FONT_DEFAULT_DECREMENT
Font settings.
Definition Globals.hpp:137
static const uint32_t G_DEFAULT_ROLLING_AVERAGE_SIZE
Default rolling average size.
Definition Globals.hpp:260
static const double G_RIGHT_EDGE_OF_MASK_M
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:355
static const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_OBJECT_SCORES_START_INDEX
The indicies representing various values in the output blobs.
Definition Globals.hpp:508
static const std::string G_TIME_UNIT
Time unit for performance-related frame times.
Definition Globals.hpp:161
static const double G_LEFT_LINE_THRESHOLD_M
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:362
static const double G_LEFT_EDGE_OF_MASK_M
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:352
static const std::array< ObjectDetectorBackEnds, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS > G_PERFORMANCE_TESTS_BACK_END_TYPES
Performance tests settings.
Definition Globals.hpp:746
static const cv::Point G_UI_POINT_RECORDING_DOT
Recording status UI locations.
Definition Globals.hpp:242
ObjectDetectorBackEnds
The supported backends for the object detector to run on. In theory, GPU should be significantly more...
Definition Globals.hpp:458
static const double G_FONT_DEFAULT_SCALE
Font settings.
Definition Globals.hpp:138
static const cv::Scalar G_COLOUR_YELLOW
OpenCV Colours (in BGR format).
Definition Globals.hpp:151
static const cv::Scalar G_COLOUR_PURPLE
OpenCV Colours (in BGR format).
Definition Globals.hpp:155
static const uint32_t G_ROI_TOP_LEFT_INDEX
The index values which represent each corner of G_ROI_MASK_POINTS.
Definition Globals.hpp:328
static const cv::Rect G_UI_RECT_NOT_RECORDING_STATUS
Recording status UI locations.
Definition Globals.hpp:244
static const cv::Scalar G_COLOUR_RED
OpenCV Colours (in BGR format).
Definition Globals.hpp:148
static const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_CENTER_X_COORD_INDEX
The indicies representing various values in the output blobs.
Definition Globals.hpp:504
static const double G_LEFT_EDGE_OF_MASK_C
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:353
static const uint32_t G_VEC4_Y2_INDEX
Hough line index mapping.
Definition Globals.hpp:395
static const std::array< cv::Point, G_NUMBER_OF_POINTS > G_ROI_MASK_POINTS
Region-of-interest points. Below is how the indicies of the array map to the points.
Definition Globals.hpp:287
static const std::map< std::string, cv::Scalar > G_OBJECT_DETECTOR_OBJECT_NAMES_AND_COLOURS
Object names and bounding box colours. G_OPENCV_WHITE is used as the default colour while custom colo...
Definition Globals.hpp:604
static const double G_HOUGH_RHO
Hough transform threshold and properties.
Definition Globals.hpp:381
static const uint32_t G_HOUGH_THRESHOLD
Hough transform threshold and properties.
Definition Globals.hpp:383
static const double G_HOUGH_LINE_HORIZONTAL_GRADIENT_THRESHOLD
Threshold gradient to decide whether a line is to be considered horizontal.
Definition Globals.hpp:401
static std::string GetTimeElapsed(const std::chrono::time_point< std::chrono::high_resolution_clock > &p_startTime)
Gets the elapsed time from p_startTime to now.
Definition Globals.hpp:49
static const uint32_t G_FONT_DEFAULT_FACE
Font settings.
Definition Globals.hpp:133
static const uint32_t G_NUMBER_OF_POINTS
Region-of-interest points. Below is how the indicies of the array map to the points.
Definition Globals.hpp:286
static const uint32_t G_ROI_BOUNDING_BOX_END_X
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:312
static const int32_t G_UI_BOTTOM_BAR_HEIGHT
UI heights.
Definition Globals.hpp:206
static const uint32_t G_KEY_TOGGLE_SAVE_OUTPUT
Keyboard values when getting user input.
Definition Globals.hpp:125
static const double G_RIGHT_EDGE_OF_MASK_C
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:356
static const double G_OBJECT_DETECTOR_SCALE_FACTOR
Object detection threshold and properties.
Definition Globals.hpp:483
static const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_TEXT_HEIGHT_OFFSET
Object detection bounding box properties.
Definition Globals.hpp:496
DrivingState
The different driving states supported by the lane detector.
Definition Globals.hpp:412
static const double G_HOUGH_THETA
Hough transform threshold and properties.
Definition Globals.hpp:382
static const uint32_t G_PERFORMANCE_TESTS_NUMBER_OF_TESTS
Performance tests settings.
Definition Globals.hpp:696
static const std::string G_CLI_HELP_MESSAGE
CLI help message for the video manager.
Definition Globals.hpp:97
static const std::array< std::string, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS > G_PERFORMANCE_TESTS_NAMES
Performance tests settings.
Definition Globals.hpp:698
static const uint32_t G_CANNY_ALGORITHM_UPPER_THRESHOLD
Canny algorithm thresholds.
Definition Globals.hpp:374
static const std::array< ObjectDetectorTypes, G_PERFORMANCE_TESTS_NUMBER_OF_TESTS > G_PERFORMANCE_TESTS_OBJECT_DETECTOR_TYPES
Performance tests settings.
Definition Globals.hpp:722
static const int32_t G_UI_SUBTITLE_HEIGHT
UI heights.
Definition Globals.hpp:208
static const cv::Scalar G_COLOUR_BLUE
OpenCV Colours (in BGR format).
Definition Globals.hpp:153
static const int32_t G_UI_TITLE_HEIGHT
UI heights.
Definition Globals.hpp:207
static const uint32_t G_CANNY_ALGORITHM_LOWER_THRESHOLD
Canny algorithm thresholds.
Definition Globals.hpp:373
static const int32_t G_ROI_TOP_WIDTH
Region-of-interest dimensions.
Definition Globals.hpp:268
static const int32_t G_OBJECT_DETECTOR_OUTPUT_BLOBS_WIDTH_INDEX
The indicies representing various values in the output blobs.
Definition Globals.hpp:506
static const double G_BOTTOM_ONE_THIRD_LOCATION
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:359
static const cv::Scalar G_COLOUR_LIGHT_RED
OpenCV Colours (in BGR format).
Definition Globals.hpp:149
static const cv::Scalar G_LANE_OVERLAY_COLOUR
Translucent colour of the overlay for the current lane.
Definition Globals.hpp:255
static const uint32_t G_ROI_BOUNDING_BOX_END_Y
The bounding box of the region-of-interest which is used to crop debugging frames....
Definition Globals.hpp:314
static const std::string G_UI_TEXT_NOT_RECORDING
Text to display whether or not recording.
Definition Globals.hpp:183
static const cv::Rect G_UI_RECT_RECORDING_STATUS
Recording status UI locations.
Definition Globals.hpp:240
static const std::string G_UI_TEXT_NOT_DEBUG_MODE
Text to display whether or not in debug mode.
Definition Globals.hpp:191
ObjectDetectorBlobSizes
The supported blob sizes for the object detector to run with. The larger the blob size the more perfo...
Definition Globals.hpp:470
static const uint32_t G_ROI_BOTTOM_LEFT_INDEX
The index values which represent each corner of G_ROI_MASK_POINTS.
Definition Globals.hpp:331
static const cv::Rect G_UI_RECT_TIMESTAMP
Timestamp UI location.
Definition Globals.hpp:214
static const cv::Scalar G_COLOUR_ORANGE
OpenCV Colours (in BGR format).
Definition Globals.hpp:150
static const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_BORDER_THICKNESS
Object detection bounding box properties.
Definition Globals.hpp:494
static const uint32_t G_CONVERT_DECIMAL_TO_PERCENTAGE
Convert a decimal value to a percentage.
Definition Globals.hpp:171
static const double G_LEFT_LINE_THRESHOLD_C
Region-of-interest sub-division line equations (y = mx + c).
Definition Globals.hpp:363
static const int32_t G_OBJECT_DETECTOR_BOUNDING_BOX_CHARACTER_WIDTH
Object detection bounding box properties.
Definition Globals.hpp:495
static const cv::Rect G_UI_RECT_DEBUG_MODE_STATUS
Debug mode status UI location.
Definition Globals.hpp:234