Move over to ABSL logging and flags.

Removes gperftools too since that wants gflags.

Here come the fireworks.

Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2024/vision/viewer.cc b/y2024/vision/viewer.cc
index d5ada14..c72c08e 100644
--- a/y2024/vision/viewer.cc
+++ b/y2024/vision/viewer.cc
@@ -12,12 +12,13 @@
 #include "frc971/vision/vision_util_lib.h"
 #include "y2024/vision/vision_util.h"
 
-DEFINE_string(capture, "",
-              "If set, capture a single image and save it to this filename.");
-DEFINE_string(channel, "/camera", "Channel name for the image.");
-DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
-DEFINE_int32(rate, 100, "Time in milliseconds to wait between images");
-DEFINE_double(scale, 1.0, "Scale factor for images being displayed");
+ABSL_FLAG(std::string, capture, "",
+          "If set, capture a single image and save it to this filename.");
+ABSL_FLAG(std::string, channel, "/camera", "Channel name for the image.");
+ABSL_FLAG(std::string, config, "aos_config.json",
+          "Path to the config file to use.");
+ABSL_FLAG(int32_t, rate, 100, "Time in milliseconds to wait between images");
+ABSL_FLAG(double, scale, 1.0, "Scale factor for images being displayed");
 
 namespace y2024::vision {
 namespace {
@@ -42,12 +43,12 @@
   cv::Mat bgr_image(cv::Size(image->cols(), image->rows()), CV_8UC3);
   cv::cvtColor(image_color_mat, bgr_image, cv::COLOR_YUV2BGR_YUYV);
 
-  if (!FLAGS_capture.empty()) {
-    if (absl::EndsWith(FLAGS_capture, ".bfbs")) {
-      aos::WriteFlatbufferToFile(FLAGS_capture,
+  if (!absl::GetFlag(FLAGS_capture).empty()) {
+    if (absl::EndsWith(absl::GetFlag(FLAGS_capture), ".bfbs")) {
+      aos::WriteFlatbufferToFile(absl::GetFlag(FLAGS_capture),
                                  image_fetcher->CopyFlatBuffer());
     } else {
-      cv::imwrite(FLAGS_capture, bgr_image);
+      cv::imwrite(absl::GetFlag(FLAGS_capture), bgr_image);
     }
 
     return false;
@@ -55,9 +56,9 @@
 
   cv::Mat undistorted_image;
   cv::undistort(bgr_image, undistorted_image, intrinsics, dist_coeffs);
-  if (FLAGS_scale != 1.0) {
-    cv::resize(undistorted_image, undistorted_image, cv::Size(), FLAGS_scale,
-               FLAGS_scale);
+  if (absl::GetFlag(FLAGS_scale) != 1.0) {
+    cv::resize(undistorted_image, undistorted_image, cv::Size(),
+               absl::GetFlag(FLAGS_scale), absl::GetFlag(FLAGS_scale));
   }
   cv::imshow("Display", undistorted_image);
 
@@ -77,7 +78,7 @@
 
 void ViewerMain() {
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   frc971::constants::WaitForConstants<y2024::Constants>(&config.message());
 
@@ -85,8 +86,8 @@
 
   frc971::constants::ConstantsFetcher<y2024::Constants> constants_fetcher(
       &event_loop);
-  CHECK(FLAGS_channel.length() == 8);
-  int camera_id = std::stoi(FLAGS_channel.substr(7, 1));
+  CHECK(absl::GetFlag(FLAGS_channel).length() == 8);
+  int camera_id = std::stoi(absl::GetFlag(FLAGS_channel).substr(7, 1));
   const auto *calibration_data = FindCameraCalibration(
       constants_fetcher.constants(), event_loop.node()->name()->string_view(),
       camera_id);
@@ -95,7 +96,7 @@
       frc971::vision::CameraDistCoeffs(calibration_data);
 
   aos::Fetcher<CameraImage> image_fetcher =
-      event_loop.MakeFetcher<CameraImage>(FLAGS_channel);
+      event_loop.MakeFetcher<CameraImage>(absl::GetFlag(FLAGS_channel));
 
   // Run the display loop
   event_loop.AddPhasedLoop(
@@ -105,7 +106,7 @@
           event_loop.Exit();
         };
       },
-      ::std::chrono::milliseconds(FLAGS_rate));
+      ::std::chrono::milliseconds(absl::GetFlag(FLAGS_rate)));
 
   event_loop.Run();