坐标变化

This commit is contained in:
2025-12-04 20:26:55 +08:00
parent 593cb37cf7
commit 8728fd88e5

View File

@@ -30,8 +30,14 @@ void output_control_data(const cv::Point2f* ballistic_point,
std::ostringstream send_str; std::ostringstream send_str;
// Calculate offset (based on actual image center) // Calculate offset (based on actual image center)
int ballistic_offset_x = static_cast<int>(ballistic_point->x - img_center.x); int ballistic_offset_x = -static_cast<int>(ballistic_point->x - img_center.x);
int ballistic_offset_y = static_cast<int>(img_center.y - ballistic_point->y); if ( abs(ballistic_offset_x) > 320){
ballistic_offset_x = ( ballistic_offset_x / abs( ballistic_offset_x ) ) * 320 ;
}
int ballistic_offset_y = -static_cast<int>(img_center.y - ballistic_point->y);
if ( abs(ballistic_offset_y) > 180 ) {
ballistic_offset_y = ( ballistic_offset_x / abs( ballistic_offset_x ) ) * 180 ;
}
// Color simplification mapping // Color simplification mapping
std::string simplified_color = target_color; std::string simplified_color = target_color;