Changes to aos/vision/debug in preparation for the competition.
- blob_log-source: Support multiple key-commands for seeking to a target
also added JustCheckForTarget which can be implemented to run faster
for slow computer (will implement in followup).
- camera-source + debug_framework: Takes in camera parameters from the
caller.
- debug_window -> Scale text up on smaller monitors.
- overlay.h: Ben changed width to measure point to point on the cross.
And added circles to the pixel-lines overlay.
- tcp-source: Drop packects when the computer can't keep up.
- debug_framework -> detect smaller monitors and scale down the viewport.
Change-Id: Iae65a0799231d006b38694a8a9cb3894e252033c
diff --git a/aos/vision/debug/overlay.h b/aos/vision/debug/overlay.h
index 5a9804f..0122c94 100644
--- a/aos/vision/debug/overlay.h
+++ b/aos/vision/debug/overlay.h
@@ -128,10 +128,10 @@
void DrawCross(aos::vision::Vector<2> center, int width,
aos::vision::PixelRef color) {
using namespace aos::vision;
- AddLine(Vector<2>(center.x() - width, center.y()),
- Vector<2>(center.x() + width, center.y()), color);
- AddLine(Vector<2>(center.x(), center.y() - width),
- Vector<2>(center.x(), center.y() + width), color);
+ AddLine(Vector<2>(center.x() - width / 2, center.y()),
+ Vector<2>(center.x() + width / 2, center.y()), color);
+ AddLine(Vector<2>(center.x(), center.y() - width / 2),
+ Vector<2>(center.x(), center.y() + width / 2), color);
}
void DrawBBox(const ImageBBox &box, aos::vision::PixelRef color) {
@@ -146,6 +146,12 @@
color);
}
+ // Build a circle as a point and radius.
+ void DrawCircle(Vector<2> center, double radius, PixelRef newColor) {
+ circles_.emplace_back(std::pair<Vector<2>, std::pair<double, PixelRef>>(
+ center, std::pair<double, PixelRef>(radius, newColor)));
+ }
+
void StartNewProfile() { start_profile = true; }
// add a new point connected to the last point in the line
@@ -171,14 +177,25 @@
render->LineTo(ln.first.B().x(), ln.first.B().y());
render->Stroke();
}
+ for (const auto &circle : circles_) {
+ PixelRef localColor = circle.second.second;
+ render->SetSourceRGB(localColor.r / 255.0, localColor.g / 255.0,
+ localColor.b / 255.0);
+ render->Circle(circle.first.x(), circle.first.y(), circle.second.first);
+ render->Stroke();
+ }
}
// Empting the list will blank the whole overlay.
- void Reset() override { lines_.clear(); }
+ void Reset() override {
+ lines_.clear();
+ circles_.clear();
+ }
private:
// Lines in this overlay.
std::vector<std::pair<Segment<2>, PixelRef>> lines_;
+ std::vector<std::pair<Vector<2>, std::pair<double, PixelRef>>> circles_;
bool start_profile = false;
};