Lane and Object Detection
Using OpenCV and YOLOv7
Loading...
Searching...
No Matches
ObjectDetector.hpp
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <vector>
6
7#include <opencv2/core/mat.hpp>
8#include <opencv2/dnn/dnn.hpp>
9
10#include "helpers/Globals.hpp"
11#include "helpers/Information.hpp"
12
18{
24 {
25 public:
29 explicit ObjectDetector();
30
43 void SetProperties(const std::string& p_yoloFolderPath,
44 const Globals::ObjectDetectorTypes& p_objectDetectorTypes,
45 const Globals::ObjectDetectorBackEnds& p_objectDetectorBackEnds,
46 const Globals::ObjectDetectorBlobSizes& p_objectDetectorBlobSizes);
47
53 void RunObjectDetector(const cv::Mat& p_frame);
54
61
62 private:
66 cv::dnn::Net m_net;
67
72
76 std::vector<std::string> m_unconnectedOutputLayerNames;
77
81 int32_t m_blobSize;
82
87 };
88}
ObjectDetectionInformation m_objectDetectionInformation
The ObjectDetectionInformation struct containing all object detection-related information.
cv::dnn::Net m_net
OpenCV object which allows the use of pre-trained neural networks.
std::vector< std::string > m_unconnectedOutputLayerNames
The names of layers with unconnected outputs.
void SetProperties(const std::string &p_yoloFolderPath, const Globals::ObjectDetectorTypes &p_objectDetectorTypes, const Globals::ObjectDetectorBackEnds &p_objectDetectorBackEnds, const Globals::ObjectDetectorBlobSizes &p_objectDetectorBlobSizes)
Set the properties of the ObjectDetector object.
int32_t m_blobSize
The spatial size for the output image used by the cv::dnn::blobFromImage function.
ObjectDetector()
Construct a new ObjectDetector object.
void RunObjectDetector(const cv::Mat &p_frame)
Run the object detector against p_frame.
bool m_skipObjectDetection
Whether to skip object detection.
ObjectDetectionInformation GetInformation()
Get the ObjectDetectionInformation struct.
ObjectDetectorTypes
The type of object detector to use with an option to disable object detection. The tiny version is mo...
Definition Globals.hpp:446
ObjectDetectorBackEnds
The supported backends for the object detector to run on. In theory, GPU should be significantly more...
Definition Globals.hpp:458
ObjectDetectorBlobSizes
The supported blob sizes for the object detector to run with. The larger the blob size the more perfo...
Definition Globals.hpp:470
Contains all Lane-and-Object-Detection objects.
The information needed by FrameBuilder to update frame with object detection information.