Fix vision pipeline: search-first IPM, IMU non-blocking, LCD inverse IPM, servo direction, model WIP
This commit is contained in:
@@ -20,7 +20,7 @@ static constexpr float CAL_FAR_Y_MM = 1050.0f; // 矩形远边 Y (mm)
|
||||
static constexpr float CAL_HALF_W_MM = 200.0f; // 矩形半宽 (mm)
|
||||
|
||||
static bool g_ipm_enabled = true; // 启用 IPM
|
||||
static cv::Mat g_ipm_matrix; // 3×3 透视变换矩阵
|
||||
cv::Mat g_ipm_matrix; // 3×3 透视变换矩阵 (extern)
|
||||
|
||||
void preprocess_init() {}
|
||||
|
||||
@@ -95,21 +95,6 @@ void preprocess_run(const cv::Mat& bgr_frame)
|
||||
cv::resize(bgr_frame, small, cv::Size(PROC_W, PROC_H));
|
||||
|
||||
cv::Mat bin = track_binarize(small);
|
||||
|
||||
// IPM 透视校正 (首次调用时计算矩阵)
|
||||
if (g_ipm_enabled)
|
||||
{
|
||||
if (g_ipm_matrix.empty())
|
||||
init_ipm_calibration();
|
||||
|
||||
cv::Mat ipm_out;
|
||||
cv::warpPerspective(bin, ipm_out, g_ipm_matrix,
|
||||
cv::Size(PROC_W, PROC_H),
|
||||
cv::INTER_LINEAR,
|
||||
cv::BORDER_CONSTANT, cv::Scalar(0));
|
||||
bin = ipm_out;
|
||||
}
|
||||
|
||||
cv::Mat track = flood_fill_track(bin);
|
||||
cv::Mat full;
|
||||
cv::resize(track, full, cv::Size(IMAGE_WIDTH, IMAGE_HEIGHT), 0, 0, cv::INTER_NEAREST);
|
||||
|
||||
Reference in New Issue
Block a user