Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
DepthDetection.hpp
1
12#ifndef DEPTH_DETECTION_HPP
13#define DEPTH_DETECTION_HPP
14
15#include "../../AutonomyConstants.h"
16#include "../../AutonomyLogging.h"
17#include "../../util/GeospatialOperations.hpp"
18#include "../../util/vision/ImageOperations.hpp"
19
21#include <opencv2/opencv.hpp>
22#include <vector>
23
25
26
34namespace depthobject
35{
36
45 {
46 public:
47 // Declare public struct member attributes.
48 cv::Point2f CornerTL; // The top left corner of the bounding box.
49 cv::Point2f CornerTR; // The top right corner of the bounding box.
50 cv::Point2f CornerBL; // The bottom left corner of the bounding box.
51 cv::Point2f CornerBR; // The bottom right corner of bounding box.
52 std::vector<cv::Point2f*> vCorners = {&CornerTL, &CornerTR, &CornerBL, &CornerBR}; // Provide an easy method for getting all corners.
53 geoops::UTMCoordinate stLocation; // The absolute position of the object stored in a UTM coordinate.
54 double dStraightLineDistance; // Distance between the object and the camera.
55 double dYawAngle; // This is the yaw angle so roll and pitch are ignored.
56 };
57
58
68 {
69 // Average of the four corners.
70 cv::Point2f cvCenter(0, 0);
71
72 // Loop through each corner of the object.
73 for (cv::Point2f* cvCorner : stObject.vCorners)
74 {
75 // Add each object x, y to the center x, y.
76 cvCenter.x += cvCorner->x;
77 cvCenter.y += cvCorner->y;
78 }
79 // Divide by number of corners.
80 cvCenter.x /= 4;
81 cvCenter.y /= 4;
82
83 // Return a copy of the center point of the object.
84 return cvCenter;
85 }
86
87 // TODO: Implement when ready, commented out to suppress warnings.
88 // /******************************************************************************
89 // * @brief Detect objects in the provided image using the depth measure image and
90 // * simple but fast filtering, masking, and blob detection algorithms.
91 // *
92 // * @param cvDepthMeasure - The depth measure image to detect objects in.
93 // * @param fMinDistance - Filter out blobs closer than this distance.
94 // * @param fMaxDistance - Filter out blobs farther than this distance.
95 // * @param fFullnessThresh - The threshold for the area or fullness of the blob.
96 // * @return std::vector<DepthObject> - A vector containing struct that hold the detected object info.
97 // *
98 // * @author clayjay3 (claytonraycowen@gmail.com)
99 // * @date 2023-10-23
100 // ******************************************************************************/
101 // inline std::vector<DepthObject> Detect(const cv::Mat& cvDepthMeasure, const float fMinDistance, const float fMaxDistance, const float fFullnessThresh)
102 // {
103 // // Put detection code here.
104 // }
105
106 // TODO: Implement when ready, commented out to suppress warnings.
107 // /******************************************************************************
108 // * @brief Given a vector of DepthObject structs draw each object corner and ID onto the given image.
109 // * Image must be a 1 or 3 channel image and image must match dimensions of image when used for
110 // * detection of the given objects.
111 // *
112 // * @param cvDetectionsFrame - The frame to draw overlay onto.
113 // * @param vDetectedObjects - The vector of DepthObject struct used to draw object corners and IDs onto image.
114 // *
115 // * @author clayjay3 (claytonraycowen@gmail.com)
116 // * @date 2023-10-19
117 // ******************************************************************************/
118 // inline void DrawDetections(cv::Mat& cvDetectionsFrame, std::vector<DepthObject> vDetectedObjects) {}
119} // namespace depthobject
120
121#endif
Namespace containing functions related to object detection operations using depth measures and images...
Definition DepthDetection.hpp:35
cv::Point2f FindObjectCenter(const DepthObject &stObject)
Given an DepthObject struct find the center point of the corners.
Definition DepthDetection.hpp:67
Represents a single depth object detection. Stores all information about a specific object detection.
Definition DepthDetection.hpp:45
This struct stores/contains information about a UTM coordinate.
Definition GeospatialOperations.hpp:244