From 216de175ee332499a8313997a418a0486b8ac5e7 Mon Sep 17 00:00:00 2001 From: WilyHyperion Date: Fri, 23 Oct 2026 00:44:37 +0000 Subject: [PATCH 1/3] feat: Move compression step to the end of the pipeline --- src/cv/pipeline.cpp | 5 +++-- src/network/gcs_routes.cpp | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cv/pipeline.cpp b/src/cv/pipeline.cpp index 25cfa45e..29fe28d8 100644 --- a/src/cv/pipeline.cpp +++ b/src/cv/pipeline.cpp @@ -126,9 +126,10 @@ PipelineResults Pipeline::run(const ImageData& imageData) { LOG_F(INFO, "Output image saved to %s", uniqueOutputPath.c_str()); } } - + std::optional compressed = compressImg(imageData.DATA); + compressImg(compressed.value_or(imageData.DATA)); + LOG_F(INFO, "Finished Pipeline on an image"); - // Wrap up the final annotated image to return ImageData processedData = imageData; processedData.DATA = processedImage; diff --git a/src/network/gcs_routes.cpp b/src/network/gcs_routes.cpp index 1e3102b6..edf7ee0f 100644 --- a/src/network/gcs_routes.cpp +++ b/src/network/gcs_routes.cpp @@ -380,10 +380,8 @@ DEF_GCS_HANDLE(Get, targets, all) { // Set the run ID target.set_run_id(run.run_id); - std::optional optCompressedImg = compressImg(run.annotatedImage); - cv::Mat compressed_image = optCompressedImg.has_value() ? - optCompressedImg->clone() : run.annotatedImage; - std::string b64 = cvMatToBase64(compressed_image); + + std::string b64 = cvMatToBase64(run.annotatedImage); target.set_picture(b64); // Ensure coords and bboxes vectors are the same size (should be guaranteed by Aggregator From 9dbe43d6e68fce0f03a3d13f4b9ef24d455ebe30 Mon Sep 17 00:00:00 2001 From: WilyHyperion Date: Fri, 23 Oct 2026 00:57:44 +0000 Subject: [PATCH 2/3] Fix: compress correct image --- src/cv/pipeline.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cv/pipeline.cpp b/src/cv/pipeline.cpp index 29fe28d8..4762db6d 100644 --- a/src/cv/pipeline.cpp +++ b/src/cv/pipeline.cpp @@ -126,14 +126,14 @@ PipelineResults Pipeline::run(const ImageData& imageData) { LOG_F(INFO, "Output image saved to %s", uniqueOutputPath.c_str()); } } - std::optional compressed = compressImg(imageData.DATA); - compressImg(compressed.value_or(imageData.DATA)); - - LOG_F(INFO, "Finished Pipeline on an image"); - // Wrap up the final annotated image to return + + // Wrap up the final annotated image to compress and return ImageData processedData = imageData; - processedData.DATA = processedImage; + std::optional compressed = compressImg(processedImage); + + processedData.DATA = compressed.value_or(processedImage);; + LOG_F(INFO, "Finished Pipeline on an image"); // Return a PipelineResults that includes: // 1) The final big image with bounding boxes drawn // 2) The bounding boxes + localized GPS coords From 16756a5d8ba3717bf8baa5ac1eb02cbfa55947fc Mon Sep 17 00:00:00 2001 From: WilyHyperion Date: Fri, 23 Oct 2026 01:43:09 +0000 Subject: [PATCH 3/3] Fix lint --- src/cv/pipeline.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cv/pipeline.cpp b/src/cv/pipeline.cpp index 4762db6d..4e9cafd6 100644 --- a/src/cv/pipeline.cpp +++ b/src/cv/pipeline.cpp @@ -130,7 +130,6 @@ PipelineResults Pipeline::run(const ImageData& imageData) { // Wrap up the final annotated image to compress and return ImageData processedData = imageData; std::optional compressed = compressImg(processedImage); - processedData.DATA = compressed.value_or(processedImage);; LOG_F(INFO, "Finished Pipeline on an image");