Make channel configurable with viewer
With images forwarded to a laptop, it is useful to be able to view
different channels worth of images. Flags!
Change-Id: Ie6e1bc5c053f7c43da52f69265b570ce54a3ae0f
diff --git a/y2020/vision/viewer.cc b/y2020/vision/viewer.cc
index 08409b2..f7c9b75 100644
--- a/y2020/vision/viewer.cc
+++ b/y2020/vision/viewer.cc
@@ -11,6 +11,7 @@
#include "y2020/vision/vision_generated.h"
DEFINE_string(config, "config.json", "Path to the config file to use.");
+DEFINE_string(channel, "/camera", "Channel name for the image.");
namespace frc971 {
namespace vision {
@@ -31,7 +32,7 @@
aos::ShmEventLoop event_loop(&config.message());
event_loop.MakeWatcher(
- "/camera", [&target_data_map](const CameraImage &image) {
+ FLAGS_channel, [&target_data_map](const CameraImage &image) {
// Create color image:
cv::Mat image_color_mat(cv::Size(image.cols(), image.rows()), CV_8UC2,
(void *)image.data()->data());
@@ -63,7 +64,7 @@
});
event_loop.MakeWatcher(
- "/camera", [&target_data_map](const sift::ImageMatchResult &match) {
+ FLAGS_channel, [&target_data_map](const sift::ImageMatchResult &match) {
int64_t timestamp = match.image_monotonic_timestamp_ns();
if (match.camera_poses() != NULL && match.camera_poses()->size() > 0) {
LOG(INFO) << "Got match!\n";