坐标变化
This commit is contained in:
@@ -30,8 +30,14 @@ void output_control_data(const cv::Point2f* ballistic_point,
|
||||
std::ostringstream send_str;
|
||||
|
||||
// Calculate offset (based on actual image center)
|
||||
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);
|
||||
int ballistic_offset_x = -static_cast<int>(ballistic_point->x - img_center.x);
|
||||
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
|
||||
std::string simplified_color = target_color;
|
||||
|
||||
Reference in New Issue
Block a user