MCPcopy Create free account
hub / github.com/autowarefoundation/vision_pilot / draw_legend

Function draw_legend

VisionPilot/modules/debug/src/debug_draw.cpp:139–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139static void draw_legend(cv::Mat& img, const OverlayLayout& L,
140 const DebugView& v)
141{
142 draw_panel(img, L.legend, "OVERLAY KEY", kClrHeader);
143
144 const int x0 = L.legend.x + 8;
145 int y = L.legend.y + 28;
146 const int dy = 16;
147
148 auto swatch = [&](int yl, cv::Scalar c, const char* txt) {
149 cv::rectangle(img, cv::Rect(x0, yl - 9, 14, 4), c, -1, cv::LINE_AA);
150 cv::putText(img, txt, cv::Point(x0 + 20, yl), kFont, 0.38, kClrNormal, 1, cv::LINE_AA);
151 };
152
153 swatch(y, kClrEgoPath, "Green AutoSteer waypoints"); y += dy;
154 swatch(y, kClrFusedLat, "Yellow Fused path (RANSAC)"); y += dy;
155
156 if (v.lateral.valid) {
157 const float st = curvature_to_steer_deg(
158 v.lateral.curvature, v.vehicle.wheelbase_m, v.vehicle.steer_ratio);
159 char buf[48];
160 std::snprintf(buf, sizeof(buf), "Fused steer %.1f deg", static_cast<double>(st));
161 cv::putText(img, buf, cv::Point(x0, y), kFont, 0.36, kClrSteerLbl, 1, cv::LINE_AA);
162 y += dy;
163 }
164 if (v.auto_drive.valid) {
165 const float curv = v.auto_drive.curvature_raw * v.vehicle.curv_scale;
166 const float st = curvature_to_steer_deg(
167 curv, v.vehicle.wheelbase_m, v.vehicle.steer_ratio);
168 char buf[48];
169 std::snprintf(buf, sizeof(buf), "AD steer %.1f deg (white wheel)", static_cast<double>(st));
170 cv::putText(img, buf, cv::Point(x0, y), kFont, 0.36, kClrAdWheel, 1, cv::LINE_AA);
171 }
172}
173
174static cv::Mat load_wheel_rgba(const fs::path& path, int size_px)
175{

Callers 1

annotate_frameFunction · 0.85

Calls 2

draw_panelFunction · 0.85
curvature_to_steer_degFunction · 0.85

Tested by

no test coverage detected