From 95b3d5076eb69bdc62e0eac661155a556d184a4e Mon Sep 17 00:00:00 2001 From: ackimixs Date: Thu, 25 Apr 2024 11:32:05 +0200 Subject: [PATCH] Add ostream for ArucoTag --- utils.cpp | 5 +++++ utils.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/utils.cpp b/utils.cpp index 51beefc..173fc0f 100644 --- a/utils.cpp +++ b/utils.cpp @@ -87,3 +87,8 @@ void ArucoTag::find() { int ArucoTag::getNbFind() const { return nbFind; } + +std::ostream& operator<<(std::ostream& os, const ArucoTag& tag) { + os << "ArucoTag{id=" << tag.id() << ", name=" << tag.name() << ", pos=[" << tag.pos()[0] << ", " << tag.pos()[1] << "], rot=[" << tag.rot()[0] << ", " << tag.rot()[1] << ", " << tag.rot()[2] << "]}"; + return os; +} diff --git a/utils.h b/utils.h index 8ef6309..28ad67e 100644 --- a/utils.h +++ b/utils.h @@ -4,6 +4,7 @@ #include #include #include +#include #define PI 3.14159265358979323846 @@ -30,6 +31,8 @@ public: ArucoTag() = default; + ArucoTag(const ArucoTag& other) = default; + [[nodiscard]] int id() const; [[nodiscard]] std::string name() const; @@ -52,6 +55,8 @@ public: [[nodiscard]] int getNbFind() const; + friend std::ostream& operator<<(std::ostream& os, const ArucoTag& tag); + private: int _id = -1; std::string _name;