14#ifndef OBJECT_DETECTION_UTILITY_HPP
15#define OBJECT_DETECTION_UTILITY_HPP
17#include "../../AutonomyConstants.h"
18#include "../../AutonomyLogging.h"
19#include "../GeospatialOperations.hpp"
22#include <opencv2/opencv.hpp>
76 std::shared_ptr<cv::Rect2d> pBoundingBox = std::make_shared<cv::Rect2d>();
77 double dConfidence = 0.0;
78 double dStraightLineDistance = 0.0;
79 double dYawAngle = 0.0;
80 std::string szClassName =
"";
81 std::chrono::system_clock::time_point tmCreation = std::chrono::system_clock::now();
85 double dHorizontalFOV = 0.0;
87 std::string szDetectorUUID =
"";
101 return *pBoundingBox == *stOther.pBoundingBox && dConfidence == stOther.dConfidence && dStraightLineDistance == stOther.dStraightLineDistance &&
102 dYawAngle == stOther.dYawAngle && szClassName == stOther.szClassName && tmCreation == stOther.tmCreation &&
103 eDetectionMethod == stOther.eDetectionMethod && eDetectionType == stOther.eDetectionType && cvImageResolution == stOther.cvImageResolution &&
104 dHorizontalFOV == stOther.dHorizontalFOV && stGeolocatedPosition == stOther.stGeolocatedPosition && szDetectorUUID == stOther.szDetectorUUID;
131 if (
this != &stOther)
134 pBoundingBox = stOther.pBoundingBox;
137 dConfidence = stOther.dConfidence;
138 dStraightLineDistance = stOther.dStraightLineDistance;
139 dYawAngle = stOther.dYawAngle;
140 szClassName = stOther.szClassName;
141 tmCreation = stOther.tmCreation;
142 eDetectionMethod = stOther.eDetectionMethod;
143 eDetectionType = stOther.eDetectionType;
144 cvImageResolution = stOther.cvImageResolution;
145 dHorizontalFOV = stOther.dHorizontalFOV;
146 stGeolocatedPosition = stOther.stGeolocatedPosition;
147 szDetectorUUID = stOther.szDetectorUUID;
165 return cv::Point2f(stObject.pBoundingBox->x + stObject.pBoundingBox->width / 2, stObject.pBoundingBox->y + stObject.pBoundingBox->height / 2);
181 double dDegreesPerPixel = stTag.dHorizontalFOV / stTag.cvImageResolution.
width;
183 double dTagErrorX = (stTag.pBoundingBox->x + stTag.pBoundingBox->width / 2) - (stTag.cvImageResolution.
width / 2);
185 double dTagAngleX = dTagErrorX * dDegreesPerPixel;
187 stTag.dYawAngle = dTagAngleX;
190 stTag.dStraightLineDistance = (stTag.pBoundingBox->area() / (stTag.cvImageResolution.
width * stTag.cvImageResolution.
height)) * 100.0;
Namespace containing functions to assist in object detection.
Definition ObjectDetectionUtility.hpp:36
void EstimatePoseFromCameraFrame(Object &stTag)
Estimate the pose of a tag from a camera frame.
Definition ObjectDetectionUtility.hpp:178
ObjectDetectionType
Enum class to define the different object detection types available.
Definition ObjectDetectionUtility.hpp:58
cv::Point2f FindObjectCenter(const Object &stObject)
Find the center of an object.
Definition ObjectDetectionUtility.hpp:162
ObjectDetectionMethod
Enum class to define the different object detection methods available.
Definition ObjectDetectionUtility.hpp:45
This struct is used by the WaypointHandler class to store location, size, and type information about ...
Definition GeospatialOperations.hpp:423
Represents a single detected object.
Definition ObjectDetectionUtility.hpp:73
bool operator==(const Object &stOther) const
Overridden operator equals for Object struct.
Definition ObjectDetectionUtility.hpp:99
Object & operator=(const Object &stOther)
Overload the assignment operator for the Object struct to perform a deep copy.
Definition ObjectDetectionUtility.hpp:128
bool operator!=(const Object &stOther) const
Overridden operator equals for Object struct.
Definition ObjectDetectionUtility.hpp:117