参考上海交大
This commit is contained in:
@@ -23,6 +23,23 @@ struct ArmorPlate {
|
||||
double confidence;
|
||||
std::pair<LightBar, LightBar> pair;
|
||||
std::vector<cv::Point2f> corners_2d; // Can be computed later for 3D pose
|
||||
|
||||
// Function to get bounding rectangle of the armor plate
|
||||
cv::Rect2d getBoundingRect() const {
|
||||
if (corners_2d.size() >= 4) {
|
||||
cv::Point2f min_pt = corners_2d[0];
|
||||
cv::Point2f max_pt = corners_2d[0];
|
||||
for (const auto& pt : corners_2d) {
|
||||
min_pt.x = std::min(min_pt.x, pt.x);
|
||||
min_pt.y = std::min(min_pt.y, pt.y);
|
||||
max_pt.x = std::max(max_pt.x, pt.x);
|
||||
max_pt.y = std::max(max_pt.y, pt.y);
|
||||
}
|
||||
return cv::Rect2d(min_pt.x, min_pt.y, max_pt.x - min_pt.x, max_pt.y - min_pt.y);
|
||||
}
|
||||
// Fallback: use center and a fixed size
|
||||
return cv::Rect2d(center.x - 30, center.y - 15, 60, 30);
|
||||
}
|
||||
};
|
||||
|
||||
class ArmorDetector {
|
||||
|
||||
2
inc/BallisticPredictor.h:Zone.Identifier
Normal file
2
inc/BallisticPredictor.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
2
inc/Camera.h:Zone.Identifier
Normal file
2
inc/Camera.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
2
inc/ImagePreprocessor.h:Zone.Identifier
Normal file
2
inc/ImagePreprocessor.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
2
inc/KalmanFilter.h:Zone.Identifier
Normal file
2
inc/KalmanFilter.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
2
inc/MindVisionCamera.h:Zone.Identifier
Normal file
2
inc/MindVisionCamera.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
2
inc/TTLCommunicator.h:Zone.Identifier
Normal file
2
inc/TTLCommunicator.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
2
inc/Visualizer.h:Zone.Identifier
Normal file
2
inc/Visualizer.h:Zone.Identifier
Normal file
@@ -0,0 +1,2 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
@@ -36,6 +36,9 @@ const float ARMOR_ANGLE_DIFF_THRESHOLD = 15.0f * CV_PI / 180.0f; // Armor light
|
||||
const float KF_PROCESS_NOISE = 0.02f; // Process noise covariance
|
||||
const float KF_MEASUREMENT_NOISE = 0.5f; // Measurement noise covariance
|
||||
|
||||
// Focal length in pixels (from camera calibration)
|
||||
const double FOCAL_PIXAL = 600.0; // This should match your actual camera calibration
|
||||
|
||||
// TTL communication settings
|
||||
const int TTL_BAUDRATE = 115200;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user