面积大小输出
This commit is contained in:
@@ -80,7 +80,7 @@ void output_control_data(const cv::Point2f* ballistic_point,
|
|||||||
|
|
||||||
// Calculate offset (based on actual image center)
|
// Calculate offset (based on actual image center)
|
||||||
float raw_offset_x = -(ballistic_point->x - img_center.x); // yaw error
|
float raw_offset_x = -(ballistic_point->x - img_center.x); // yaw error
|
||||||
float raw_offset_y = -(img_center.y - ballistic_point->y - 30); // pitch error
|
float raw_offset_y = -(img_center.y - ballistic_point->y ); // pitch error
|
||||||
|
|
||||||
// Calculate time delta
|
// Calculate time delta
|
||||||
static auto last_time = std::chrono::high_resolution_clock::now();
|
static auto last_time = std::chrono::high_resolution_clock::now();
|
||||||
@@ -416,6 +416,17 @@ int main(int /*argc*/, char* /*argv*/[]) {
|
|||||||
|
|
||||||
frame_counter++;
|
frame_counter++;
|
||||||
|
|
||||||
|
float area = 0.0;
|
||||||
|
if (!armor_plates.empty()) {
|
||||||
|
// 获取装甲板配对的第一个灯条
|
||||||
|
const LightBar& light_bar = armor_plates[0].pair.first;
|
||||||
|
// 直接使用灯条的area(即rect_area)赋值
|
||||||
|
area = light_bar.area;
|
||||||
|
// 额外校验:确保灯条面积有效(避免负数/0值)
|
||||||
|
if (area <= 0) {
|
||||||
|
area = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Control max frame rate (100 FPS)
|
// Control max frame rate (100 FPS)
|
||||||
auto end_time = std::chrono::high_resolution_clock::now();
|
auto end_time = std::chrono::high_resolution_clock::now();
|
||||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - current_time).count();
|
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - current_time).count();
|
||||||
|
|||||||
Reference in New Issue
Block a user