Add support for different image formats in ImageCallback
The april tag code is faster in halide than opencv.
Change-Id: I6531c5a45158e8bd5e50ee0b0ff69cc1978bf588
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/vision/charuco_lib.h b/frc971/vision/charuco_lib.h
index fdf25e1..f4f1233 100644
--- a/frc971/vision/charuco_lib.h
+++ b/frc971/vision/charuco_lib.h
@@ -51,10 +51,19 @@
// full-service callback functionality
class ImageCallback {
public:
+ enum class Format {
+ YUYV2 = 0,
+ BGR = 1,
+ GRAYSCALE = 2,
+ };
ImageCallback(aos::EventLoop *event_loop, std::string_view channel,
std::function<void(cv::Mat, aos::monotonic_clock::time_point)>
&&handle_image_fn);
+ void set_format(Format format) {
+ format_ = format;
+ }
+
private:
void DisableTracing();
@@ -67,6 +76,8 @@
bool disabling_ = false;
aos::Ftrace ftrace_;
+
+ Format format_ = Format::BGR;
};
// Class which calls a callback each time an image arrives with the information