参考上海交通大学代码进行修改

This commit is contained in:
2025-12-05 11:13:37 +08:00
parent 593cb37cf7
commit f6e7d37da9
41 changed files with 2297 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#ifndef BALLISTICPREDICTOR_H
#define BALLISTICPREDICTOR_H
#include <opencv2/opencv.hpp>
class BallisticPredictor {
public:
BallisticPredictor(float bullet_speed = 16.0f);
~BallisticPredictor(); // Added destructor to properly manage memory
// Predict ballistic point considering target movement and flight time
cv::Point2f* predict_ballistic_point(const cv::Point2f* predicted_center,
const cv::Point2f& img_center,
const cv::Point2f& target_speed);
// Get last ballistic point
const cv::Point2f* get_last_ballistic_point() const { return last_ballistic_point; }
private:
float bullet_speed; // Bullet speed (m/s)
float armor_half_width; // Armor half width (converted to meters)
float armor_half_height; // Armor half height (converted to meters)
cv::Point2f* last_ballistic_point; // Last ballistic prediction
// Calculate distance to target
float calculate_distance(const cv::Point2f& armor_center, const cv::Point2f& img_center, float focal_length = 800.0f);
};
#endif // BALLISTICPREDICTOR_H