Reduce default JPEG quality for foxglove
Change-Id: I6af9e449dca1f923b930d8f498ae6867fde46a2b
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/frc971/vision/foxglove_image_converter_lib.cc b/frc971/vision/foxglove_image_converter_lib.cc
index f5ecb40..920eaf7 100644
--- a/frc971/vision/foxglove_image_converter_lib.cc
+++ b/frc971/vision/foxglove_image_converter_lib.cc
@@ -3,7 +3,7 @@
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
-DEFINE_int32(jpeg_quality, 95,
+DEFINE_int32(jpeg_quality, 60,
"Compression quality of JPEGs, 0-100; lower numbers mean lower "
"quality and resulting image sizes.");
diff --git a/frc971/vision/foxglove_image_converter_test.cc b/frc971/vision/foxglove_image_converter_test.cc
index e027de2..7a3f786 100644
--- a/frc971/vision/foxglove_image_converter_test.cc
+++ b/frc971/vision/foxglove_image_converter_test.cc
@@ -6,6 +6,8 @@
#include "aos/testing/tmpdir.h"
#include "gtest/gtest.h"
+DECLARE_int32(jpeg_quality);
+
namespace frc971::vision {
std::ostream &operator<<(std::ostream &os, ImageCompression compression) {
os << ExtensionForCompression(compression);
@@ -29,6 +31,10 @@
GetParam()),
output_path_(absl::StrCat(aos::testing::TestTmpDir(), "/test.",
ExtensionForCompression(GetParam()))) {
+ // Because our test image for comparison was generated with a JPEG quality
+ // of 95, we need to use that for the test to work. This also protects the
+ // tests against future changes to the default JPEG quality.
+ FLAGS_jpeg_quality = 95;
test_event_loop_->OnRun(
[this]() { image_sender_.CheckOk(image_sender_.Send(camera_image_)); });
test_event_loop_->MakeWatcher(