diff --git a/include/CVTracker.h b/include/CVTracker.h index 6faec3ce5..2b9e4fa4d 100644 --- a/include/CVTracker.h +++ b/include/CVTracker.h @@ -1,20 +1,57 @@ - +#include #include #include #include +#include + +#include "trackerdata.pb.h" using namespace cv; +using namespace std; +using google::protobuf::util::TimeUtil; +struct FrameData{ + int frame_id = -1; + float rotation = 0; + int x1 = -1; + int y1 = -1; + int x2 = -1; + int y2 = -1; + + // constructor + FrameData( int _frame_id) + {frame_id = _frame_id;} + + FrameData( int _frame_id , float _rotation, int _x1, int _y1, int _x2, int _y2) + { + frame_id = _frame_id; + rotation = _rotation; + x1 = _x1; + y1 = _y1; + x2 = _x2; + y2 = _y2; + } +}; class CVTracker { - public: + public: + // List of tracker types in OpenCV + std::string trackerTypes[8] = {"BOOSTING", "MIL", "KCF", "TLD","MEDIANFLOW", "GOTURN", "MOSSE", "CSRT"}; + + std::vector trackedData; std::string trackerType; Ptr tracker; Rect2d bbox; CVTracker(); Ptr select_tracker(std::string trackerType); - bool initTracker(Rect2d bbox, Mat &frame); - bool trackFrame(Mat &frame); + bool initTracker(Rect2d bbox, Mat &frame, int frameId); + bool trackFrame(Mat &frame, int frameId); + + // Save protobuf file + bool SaveTrackedData(std::string outputFilePath); + void AddFrameDataToProto(libopenshottracker::Frame* pbFrameData, FrameData& fData); + // Load protobuf file + bool LoadTrackedData(std::string inputFilePath); }; diff --git a/include/trackerdata.pb.h b/include/trackerdata.pb.h new file mode 100644 index 000000000..8225113ff --- /dev/null +++ b/include/trackerdata.pb.h @@ -0,0 +1,931 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: trackerdata.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_trackerdata_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_trackerdata_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3012000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3012003 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_trackerdata_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_trackerdata_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[3] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_trackerdata_2eproto; +namespace libopenshottracker { +class Frame; +class FrameDefaultTypeInternal; +extern FrameDefaultTypeInternal _Frame_default_instance_; +class Frame_Box; +class Frame_BoxDefaultTypeInternal; +extern Frame_BoxDefaultTypeInternal _Frame_Box_default_instance_; +class Tracker; +class TrackerDefaultTypeInternal; +extern TrackerDefaultTypeInternal _Tracker_default_instance_; +} // namespace libopenshottracker +PROTOBUF_NAMESPACE_OPEN +template<> ::libopenshottracker::Frame* Arena::CreateMaybeMessage<::libopenshottracker::Frame>(Arena*); +template<> ::libopenshottracker::Frame_Box* Arena::CreateMaybeMessage<::libopenshottracker::Frame_Box>(Arena*); +template<> ::libopenshottracker::Tracker* Arena::CreateMaybeMessage<::libopenshottracker::Tracker>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace libopenshottracker { + +// =================================================================== + +class Frame_Box PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:libopenshottracker.Frame.Box) */ { + public: + inline Frame_Box() : Frame_Box(nullptr) {}; + virtual ~Frame_Box(); + + Frame_Box(const Frame_Box& from); + Frame_Box(Frame_Box&& from) noexcept + : Frame_Box() { + *this = ::std::move(from); + } + + inline Frame_Box& operator=(const Frame_Box& from) { + CopyFrom(from); + return *this; + } + inline Frame_Box& operator=(Frame_Box&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const Frame_Box& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const Frame_Box* internal_default_instance() { + return reinterpret_cast( + &_Frame_Box_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(Frame_Box& a, Frame_Box& b) { + a.Swap(&b); + } + inline void Swap(Frame_Box* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Frame_Box* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Frame_Box* New() const final { + return CreateMaybeMessage(nullptr); + } + + Frame_Box* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Frame_Box& from); + void MergeFrom(const Frame_Box& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Frame_Box* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "libopenshottracker.Frame.Box"; + } + protected: + explicit Frame_Box(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_trackerdata_2eproto); + return ::descriptor_table_trackerdata_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kX1FieldNumber = 1, + kY1FieldNumber = 2, + kX2FieldNumber = 3, + kY2FieldNumber = 4, + }; + // int32 x1 = 1; + void clear_x1(); + ::PROTOBUF_NAMESPACE_ID::int32 x1() const; + void set_x1(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_x1() const; + void _internal_set_x1(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 y1 = 2; + void clear_y1(); + ::PROTOBUF_NAMESPACE_ID::int32 y1() const; + void set_y1(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_y1() const; + void _internal_set_y1(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 x2 = 3; + void clear_x2(); + ::PROTOBUF_NAMESPACE_ID::int32 x2() const; + void set_x2(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_x2() const; + void _internal_set_x2(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // int32 y2 = 4; + void clear_y2(); + ::PROTOBUF_NAMESPACE_ID::int32 y2() const; + void set_y2(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_y2() const; + void _internal_set_y2(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:libopenshottracker.Frame.Box) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::int32 x1_; + ::PROTOBUF_NAMESPACE_ID::int32 y1_; + ::PROTOBUF_NAMESPACE_ID::int32 x2_; + ::PROTOBUF_NAMESPACE_ID::int32 y2_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_trackerdata_2eproto; +}; +// ------------------------------------------------------------------- + +class Frame PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:libopenshottracker.Frame) */ { + public: + inline Frame() : Frame(nullptr) {}; + virtual ~Frame(); + + Frame(const Frame& from); + Frame(Frame&& from) noexcept + : Frame() { + *this = ::std::move(from); + } + + inline Frame& operator=(const Frame& from) { + CopyFrom(from); + return *this; + } + inline Frame& operator=(Frame&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const Frame& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const Frame* internal_default_instance() { + return reinterpret_cast( + &_Frame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(Frame& a, Frame& b) { + a.Swap(&b); + } + inline void Swap(Frame* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Frame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Frame* New() const final { + return CreateMaybeMessage(nullptr); + } + + Frame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Frame& from); + void MergeFrom(const Frame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Frame* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "libopenshottracker.Frame"; + } + protected: + explicit Frame(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_trackerdata_2eproto); + return ::descriptor_table_trackerdata_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef Frame_Box Box; + + // accessors ------------------------------------------------------- + + enum : int { + kBoundingBoxFieldNumber = 3, + kIdFieldNumber = 1, + kRotationFieldNumber = 2, + }; + // .libopenshottracker.Frame.Box bounding_box = 3; + bool has_bounding_box() const; + private: + bool _internal_has_bounding_box() const; + public: + void clear_bounding_box(); + const ::libopenshottracker::Frame_Box& bounding_box() const; + ::libopenshottracker::Frame_Box* release_bounding_box(); + ::libopenshottracker::Frame_Box* mutable_bounding_box(); + void set_allocated_bounding_box(::libopenshottracker::Frame_Box* bounding_box); + private: + const ::libopenshottracker::Frame_Box& _internal_bounding_box() const; + ::libopenshottracker::Frame_Box* _internal_mutable_bounding_box(); + public: + void unsafe_arena_set_allocated_bounding_box( + ::libopenshottracker::Frame_Box* bounding_box); + ::libopenshottracker::Frame_Box* unsafe_arena_release_bounding_box(); + + // int32 id = 1; + void clear_id(); + ::PROTOBUF_NAMESPACE_ID::int32 id() const; + void set_id(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_id() const; + void _internal_set_id(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // float rotation = 2; + void clear_rotation(); + float rotation() const; + void set_rotation(float value); + private: + float _internal_rotation() const; + void _internal_set_rotation(float value); + public: + + // @@protoc_insertion_point(class_scope:libopenshottracker.Frame) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::libopenshottracker::Frame_Box* bounding_box_; + ::PROTOBUF_NAMESPACE_ID::int32 id_; + float rotation_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_trackerdata_2eproto; +}; +// ------------------------------------------------------------------- + +class Tracker PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:libopenshottracker.Tracker) */ { + public: + inline Tracker() : Tracker(nullptr) {}; + virtual ~Tracker(); + + Tracker(const Tracker& from); + Tracker(Tracker&& from) noexcept + : Tracker() { + *this = ::std::move(from); + } + + inline Tracker& operator=(const Tracker& from) { + CopyFrom(from); + return *this; + } + inline Tracker& operator=(Tracker&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const Tracker& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const Tracker* internal_default_instance() { + return reinterpret_cast( + &_Tracker_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(Tracker& a, Tracker& b) { + a.Swap(&b); + } + inline void Swap(Tracker* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Tracker* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Tracker* New() const final { + return CreateMaybeMessage(nullptr); + } + + Tracker* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Tracker& from); + void MergeFrom(const Tracker& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Tracker* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "libopenshottracker.Tracker"; + } + protected: + explicit Tracker(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_trackerdata_2eproto); + return ::descriptor_table_trackerdata_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFrameFieldNumber = 1, + kLastUpdatedFieldNumber = 2, + }; + // repeated .libopenshottracker.Frame frame = 1; + int frame_size() const; + private: + int _internal_frame_size() const; + public: + void clear_frame(); + ::libopenshottracker::Frame* mutable_frame(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::libopenshottracker::Frame >* + mutable_frame(); + private: + const ::libopenshottracker::Frame& _internal_frame(int index) const; + ::libopenshottracker::Frame* _internal_add_frame(); + public: + const ::libopenshottracker::Frame& frame(int index) const; + ::libopenshottracker::Frame* add_frame(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::libopenshottracker::Frame >& + frame() const; + + // .google.protobuf.Timestamp last_updated = 2; + bool has_last_updated() const; + private: + bool _internal_has_last_updated() const; + public: + void clear_last_updated(); + const PROTOBUF_NAMESPACE_ID::Timestamp& last_updated() const; + PROTOBUF_NAMESPACE_ID::Timestamp* release_last_updated(); + PROTOBUF_NAMESPACE_ID::Timestamp* mutable_last_updated(); + void set_allocated_last_updated(PROTOBUF_NAMESPACE_ID::Timestamp* last_updated); + private: + const PROTOBUF_NAMESPACE_ID::Timestamp& _internal_last_updated() const; + PROTOBUF_NAMESPACE_ID::Timestamp* _internal_mutable_last_updated(); + public: + void unsafe_arena_set_allocated_last_updated( + PROTOBUF_NAMESPACE_ID::Timestamp* last_updated); + PROTOBUF_NAMESPACE_ID::Timestamp* unsafe_arena_release_last_updated(); + + // @@protoc_insertion_point(class_scope:libopenshottracker.Tracker) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::libopenshottracker::Frame > frame_; + PROTOBUF_NAMESPACE_ID::Timestamp* last_updated_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_trackerdata_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// Frame_Box + +// int32 x1 = 1; +inline void Frame_Box::clear_x1() { + x1_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::_internal_x1() const { + return x1_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::x1() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.Box.x1) + return _internal_x1(); +} +inline void Frame_Box::_internal_set_x1(::PROTOBUF_NAMESPACE_ID::int32 value) { + + x1_ = value; +} +inline void Frame_Box::set_x1(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_x1(value); + // @@protoc_insertion_point(field_set:libopenshottracker.Frame.Box.x1) +} + +// int32 y1 = 2; +inline void Frame_Box::clear_y1() { + y1_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::_internal_y1() const { + return y1_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::y1() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.Box.y1) + return _internal_y1(); +} +inline void Frame_Box::_internal_set_y1(::PROTOBUF_NAMESPACE_ID::int32 value) { + + y1_ = value; +} +inline void Frame_Box::set_y1(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_y1(value); + // @@protoc_insertion_point(field_set:libopenshottracker.Frame.Box.y1) +} + +// int32 x2 = 3; +inline void Frame_Box::clear_x2() { + x2_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::_internal_x2() const { + return x2_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::x2() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.Box.x2) + return _internal_x2(); +} +inline void Frame_Box::_internal_set_x2(::PROTOBUF_NAMESPACE_ID::int32 value) { + + x2_ = value; +} +inline void Frame_Box::set_x2(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_x2(value); + // @@protoc_insertion_point(field_set:libopenshottracker.Frame.Box.x2) +} + +// int32 y2 = 4; +inline void Frame_Box::clear_y2() { + y2_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::_internal_y2() const { + return y2_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame_Box::y2() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.Box.y2) + return _internal_y2(); +} +inline void Frame_Box::_internal_set_y2(::PROTOBUF_NAMESPACE_ID::int32 value) { + + y2_ = value; +} +inline void Frame_Box::set_y2(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_y2(value); + // @@protoc_insertion_point(field_set:libopenshottracker.Frame.Box.y2) +} + +// ------------------------------------------------------------------- + +// Frame + +// int32 id = 1; +inline void Frame::clear_id() { + id_ = 0; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame::_internal_id() const { + return id_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Frame::id() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.id) + return _internal_id(); +} +inline void Frame::_internal_set_id(::PROTOBUF_NAMESPACE_ID::int32 value) { + + id_ = value; +} +inline void Frame::set_id(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_id(value); + // @@protoc_insertion_point(field_set:libopenshottracker.Frame.id) +} + +// float rotation = 2; +inline void Frame::clear_rotation() { + rotation_ = 0; +} +inline float Frame::_internal_rotation() const { + return rotation_; +} +inline float Frame::rotation() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.rotation) + return _internal_rotation(); +} +inline void Frame::_internal_set_rotation(float value) { + + rotation_ = value; +} +inline void Frame::set_rotation(float value) { + _internal_set_rotation(value); + // @@protoc_insertion_point(field_set:libopenshottracker.Frame.rotation) +} + +// .libopenshottracker.Frame.Box bounding_box = 3; +inline bool Frame::_internal_has_bounding_box() const { + return this != internal_default_instance() && bounding_box_ != nullptr; +} +inline bool Frame::has_bounding_box() const { + return _internal_has_bounding_box(); +} +inline void Frame::clear_bounding_box() { + if (GetArena() == nullptr && bounding_box_ != nullptr) { + delete bounding_box_; + } + bounding_box_ = nullptr; +} +inline const ::libopenshottracker::Frame_Box& Frame::_internal_bounding_box() const { + const ::libopenshottracker::Frame_Box* p = bounding_box_; + return p != nullptr ? *p : *reinterpret_cast( + &::libopenshottracker::_Frame_Box_default_instance_); +} +inline const ::libopenshottracker::Frame_Box& Frame::bounding_box() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Frame.bounding_box) + return _internal_bounding_box(); +} +inline void Frame::unsafe_arena_set_allocated_bounding_box( + ::libopenshottracker::Frame_Box* bounding_box) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bounding_box_); + } + bounding_box_ = bounding_box; + if (bounding_box) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:libopenshottracker.Frame.bounding_box) +} +inline ::libopenshottracker::Frame_Box* Frame::release_bounding_box() { + auto temp = unsafe_arena_release_bounding_box(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::libopenshottracker::Frame_Box* Frame::unsafe_arena_release_bounding_box() { + // @@protoc_insertion_point(field_release:libopenshottracker.Frame.bounding_box) + + ::libopenshottracker::Frame_Box* temp = bounding_box_; + bounding_box_ = nullptr; + return temp; +} +inline ::libopenshottracker::Frame_Box* Frame::_internal_mutable_bounding_box() { + + if (bounding_box_ == nullptr) { + auto* p = CreateMaybeMessage<::libopenshottracker::Frame_Box>(GetArena()); + bounding_box_ = p; + } + return bounding_box_; +} +inline ::libopenshottracker::Frame_Box* Frame::mutable_bounding_box() { + // @@protoc_insertion_point(field_mutable:libopenshottracker.Frame.bounding_box) + return _internal_mutable_bounding_box(); +} +inline void Frame::set_allocated_bounding_box(::libopenshottracker::Frame_Box* bounding_box) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bounding_box_; + } + if (bounding_box) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bounding_box); + if (message_arena != submessage_arena) { + bounding_box = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bounding_box, submessage_arena); + } + + } else { + + } + bounding_box_ = bounding_box; + // @@protoc_insertion_point(field_set_allocated:libopenshottracker.Frame.bounding_box) +} + +// ------------------------------------------------------------------- + +// Tracker + +// repeated .libopenshottracker.Frame frame = 1; +inline int Tracker::_internal_frame_size() const { + return frame_.size(); +} +inline int Tracker::frame_size() const { + return _internal_frame_size(); +} +inline void Tracker::clear_frame() { + frame_.Clear(); +} +inline ::libopenshottracker::Frame* Tracker::mutable_frame(int index) { + // @@protoc_insertion_point(field_mutable:libopenshottracker.Tracker.frame) + return frame_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::libopenshottracker::Frame >* +Tracker::mutable_frame() { + // @@protoc_insertion_point(field_mutable_list:libopenshottracker.Tracker.frame) + return &frame_; +} +inline const ::libopenshottracker::Frame& Tracker::_internal_frame(int index) const { + return frame_.Get(index); +} +inline const ::libopenshottracker::Frame& Tracker::frame(int index) const { + // @@protoc_insertion_point(field_get:libopenshottracker.Tracker.frame) + return _internal_frame(index); +} +inline ::libopenshottracker::Frame* Tracker::_internal_add_frame() { + return frame_.Add(); +} +inline ::libopenshottracker::Frame* Tracker::add_frame() { + // @@protoc_insertion_point(field_add:libopenshottracker.Tracker.frame) + return _internal_add_frame(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::libopenshottracker::Frame >& +Tracker::frame() const { + // @@protoc_insertion_point(field_list:libopenshottracker.Tracker.frame) + return frame_; +} + +// .google.protobuf.Timestamp last_updated = 2; +inline bool Tracker::_internal_has_last_updated() const { + return this != internal_default_instance() && last_updated_ != nullptr; +} +inline bool Tracker::has_last_updated() const { + return _internal_has_last_updated(); +} +inline const PROTOBUF_NAMESPACE_ID::Timestamp& Tracker::_internal_last_updated() const { + const PROTOBUF_NAMESPACE_ID::Timestamp* p = last_updated_; + return p != nullptr ? *p : *reinterpret_cast( + &PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_); +} +inline const PROTOBUF_NAMESPACE_ID::Timestamp& Tracker::last_updated() const { + // @@protoc_insertion_point(field_get:libopenshottracker.Tracker.last_updated) + return _internal_last_updated(); +} +inline void Tracker::unsafe_arena_set_allocated_last_updated( + PROTOBUF_NAMESPACE_ID::Timestamp* last_updated) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(last_updated_); + } + last_updated_ = last_updated; + if (last_updated) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:libopenshottracker.Tracker.last_updated) +} +inline PROTOBUF_NAMESPACE_ID::Timestamp* Tracker::release_last_updated() { + auto temp = unsafe_arena_release_last_updated(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline PROTOBUF_NAMESPACE_ID::Timestamp* Tracker::unsafe_arena_release_last_updated() { + // @@protoc_insertion_point(field_release:libopenshottracker.Tracker.last_updated) + + PROTOBUF_NAMESPACE_ID::Timestamp* temp = last_updated_; + last_updated_ = nullptr; + return temp; +} +inline PROTOBUF_NAMESPACE_ID::Timestamp* Tracker::_internal_mutable_last_updated() { + + if (last_updated_ == nullptr) { + auto* p = CreateMaybeMessage(GetArena()); + last_updated_ = p; + } + return last_updated_; +} +inline PROTOBUF_NAMESPACE_ID::Timestamp* Tracker::mutable_last_updated() { + // @@protoc_insertion_point(field_mutable:libopenshottracker.Tracker.last_updated) + return _internal_mutable_last_updated(); +} +inline void Tracker::set_allocated_last_updated(PROTOBUF_NAMESPACE_ID::Timestamp* last_updated) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(last_updated_); + } + if (last_updated) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(last_updated)->GetArena(); + if (message_arena != submessage_arena) { + last_updated = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, last_updated, submessage_arena); + } + + } else { + + } + last_updated_ = last_updated; + // @@protoc_insertion_point(field_set_allocated:libopenshottracker.Tracker.last_updated) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace libopenshottracker + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_trackerdata_2eproto diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c11f93af7..c9c075e75 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,6 +81,10 @@ endif() find_package( OpenCV 4 REQUIRED ) +################ PROTOBUF ################## + +find_package(Protobuf REQUIRED) +include_directories(${PROTOBUF_INCLUDE_DIR}) ################# LIBOPENSHOT-AUDIO ################### # Find JUCE-based openshot Audio libraries @@ -171,6 +175,11 @@ set(OPENSHOT_SOURCES Timeline.cpp CVTracker.cpp) +# Compiled Protobuf messages +set(PROTOBUF_MESSAGES + trackerdata.pb.cc) + + # Video effects set(EFFECTS_SOURCES effects/Bars.cpp @@ -213,6 +222,7 @@ target_sources(openshot PRIVATE ${EFFECTS_SOURCES} ${QT_PLAYER_SOURCES} ${OPENSHOT_QT_HEADERS} + ${PROTOBUF_MESSAGES} ) # Set SONAME and other library properties @@ -372,7 +382,8 @@ endif() target_link_libraries(openshot PUBLIC ${LIBOPENSHOT_AUDIO_LIBRARIES} ${PROFILER} - ${OpenCV_LIBS}) + ${OpenCV_LIBS} + ${PROTOBUF_LIBRARY}) if(ImageMagick_FOUND) target_link_libraries(openshot PUBLIC ${ImageMagick_LIBRARIES}) diff --git a/src/CVTracker.cpp b/src/CVTracker.cpp index 1f8866b97..310336fba 100644 --- a/src/CVTracker.cpp +++ b/src/CVTracker.cpp @@ -1,18 +1,10 @@ #include "../include/CVTracker.h" -using namespace cv; - - CVTracker::CVTracker(){ - // List of tracker types in OpenCV 3.4.1 - std::string trackerTypes[8] = {"BOOSTING", "MIL", "KCF", "TLD","MEDIANFLOW", "GOTURN", "MOSSE", "CSRT"}; - // vector trackerTypes(types, std::end(types)); - // Create a tracker + // Create KCF tracker trackerType = trackerTypes[2]; - tracker = select_tracker(trackerType); - } Ptr CVTracker::select_tracker(std::string trackerType){ @@ -45,24 +37,22 @@ Ptr CVTracker::select_tracker(std::string trackerType){ return t; } +bool CVTracker::initTracker(Rect2d initial_bbox, Mat &frame, int frameId){ -bool CVTracker::initTracker(Rect2d initial_bbox, Mat &frame){ - // Rect2d bbox(287, 23, 86, 320); - bbox = initial_bbox; - - // Uncomment the line below to select a different bounding box - // bbox = selectROI(frame, false); - // Display bounding box. + bbox = initial_bbox; rectangle(frame, bbox, Scalar( 255, 0, 0 ), 2, 1 ); - + // Create new tracker object tracker = select_tracker(trackerType); tracker->init(frame, bbox); + // Add new frame data + trackedData.push_back(FrameData(frameId, 0, bbox.x, bbox.y, bbox.x+bbox.width, bbox.y+bbox.height)); + return true; } -bool CVTracker::trackFrame(Mat &frame){ +bool CVTracker::trackFrame(Mat &frame, int frameId){ // Update the tracking result bool ok = tracker->update(frame, bbox); @@ -70,12 +60,109 @@ bool CVTracker::trackFrame(Mat &frame){ { // Tracking success : Draw the tracked object rectangle(frame, bbox, Scalar( 255, 0, 0 ), 2, 1 ); + + // Add new frame data + trackedData.push_back(FrameData(frameId, 0, bbox.x, bbox.y, bbox.x+bbox.width, bbox.y+bbox.height)); + } else { // Tracking failure detected. putText(frame, "Tracking failure detected", Point(100,80), FONT_HERSHEY_SIMPLEX, 0.75, Scalar(0,0,255),2); + + // Add new frame data + trackedData.push_back(FrameData(frameId)); + } return ok; } + +bool CVTracker::SaveTrackedData(std::string outputFilePath){ + // Create tracker message + libopenshottracker::Tracker trackerMessage; + + // Add all frames data + for(int i=0; i < trackedData.size(); i++){ + + FrameData fData = trackedData[i]; + libopenshottracker::Frame* pbFrameData; + AddFrameDataToProto(trackerMessage.add_frame(), fData); + } + + // Add timestamp + *trackerMessage.mutable_last_updated() = TimeUtil::SecondsToTimestamp(time(NULL)); + + { + // Write the new message to disk. + std::fstream output(outputFilePath, ios::out | ios::trunc | ios::binary); + if (!trackerMessage.SerializeToOstream(&output)) { + cerr << "Failed to write protobuf message." << endl; + return false; + } + } + + // Delete all global objects allocated by libprotobuf. + google::protobuf::ShutdownProtobufLibrary(); + + return true; + +} + +// Add frame tracked data into protobuf message. +void CVTracker::AddFrameDataToProto(libopenshottracker::Frame* pbFrameData, FrameData& fData) { + + pbFrameData->set_id(fData.frame_id); + pbFrameData->set_rotation(fData.frame_id); + pbFrameData->set_rotation(fData.frame_id); + + libopenshottracker::Frame::Box* box = pbFrameData->mutable_bounding_box(); + box->set_x1(fData.x1); + box->set_y1(fData.y1); + box->set_x2(fData.x2); + box->set_y2(fData.y2); + +} + +bool CVTracker::LoadTrackedData(std::string inputFilePath){ + + libopenshottracker::Tracker trackerMessage; + + { + // Read the existing tracker message. + fstream input(inputFilePath, ios::in | ios::binary); + if (!trackerMessage.ParseFromIstream(&input)) { + cerr << "Failed to parse protobuf message." << endl; + return false; + } + } + + // Make sure the trackedData is empty + trackedData.clear(); + trackedData.reserve(trackerMessage.frame_size()); + + // Iterate over all frames of the saved message + for (int i = 0; i < trackerMessage.frame_size(); i++) { + const libopenshottracker::Frame& pbFrameData = trackerMessage.frame(i); + + int id = pbFrameData.id(); + float rotation = pbFrameData.rotation(); + + const libopenshottracker::Frame::Box& box = pbFrameData.bounding_box(); + int x1 = box.x1(); + int y1 = box.y1(); + int x2 = box.x2(); + int y2 = box.y2(); + + trackedData[i] = FrameData(id, rotation, x1, y1, x2, y2); + } + + if (trackerMessage.has_last_updated()) { + cout << " Loaded Data. Saved Time Stamp: " << TimeUtil::ToString(trackerMessage.last_updated()) << endl; + } + + // Delete all global objects allocated by libprotobuf. + google::protobuf::ShutdownProtobufLibrary(); + + return true; +} diff --git a/src/examples/Example_opencv.cpp b/src/examples/Example_opencv.cpp index daec00530..db3ea5834 100644 --- a/src/examples/Example_opencv.cpp +++ b/src/examples/Example_opencv.cpp @@ -32,8 +32,9 @@ #include #include #include +// #include #include "../../include/CVTracker.h" - +// #include "treackerdata.pb.h" #include "../../include/OpenShot.h" #include "../../include/CrashHandler.h" @@ -94,20 +95,27 @@ int main(int argc, char* argv[]) { if(!trackerInit){ Rect2d bbox = selectROI("Display Image", cvimage); - kcfTracker.initTracker(bbox, cvimage); + kcfTracker.initTracker(bbox, cvimage, frame_number); trackerInit = true; } else{ - trackerInit = kcfTracker.trackFrame(cvimage); + trackerInit = kcfTracker.trackFrame(cvimage, frame_number); } cv::imshow("Display Image", cvimage); - cv::waitKey(30); - + // Press ESC on keyboard to exit + char c=(char)waitKey(25); + if(c==27) + break; w9.WriteFrame(f); } + + // Save tracked data to file + std::cout << "Saving tracker data!" << std::endl; + kcfTracker.SaveTrackedData("kcf_tracker.data"); + // Close writer & reader w9.Close(); diff --git a/src/trackerdata.pb.cc b/src/trackerdata.pb.cc new file mode 100644 index 000000000..24194e0ea --- /dev/null +++ b/src/trackerdata.pb.cc @@ -0,0 +1,969 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: trackerdata.proto + +#include "trackerdata.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include +extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2ftimestamp_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_trackerdata_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Frame_trackerdata_2eproto; +extern PROTOBUF_INTERNAL_EXPORT_trackerdata_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Frame_Box_trackerdata_2eproto; +namespace libopenshottracker { +class Frame_BoxDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _Frame_Box_default_instance_; +class FrameDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _Frame_default_instance_; +class TrackerDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _Tracker_default_instance_; +} // namespace libopenshottracker +static void InitDefaultsscc_info_Frame_trackerdata_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::libopenshottracker::_Frame_default_instance_; + new (ptr) ::libopenshottracker::Frame(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::libopenshottracker::Frame::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Frame_trackerdata_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_Frame_trackerdata_2eproto}, { + &scc_info_Frame_Box_trackerdata_2eproto.base,}}; + +static void InitDefaultsscc_info_Frame_Box_trackerdata_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::libopenshottracker::_Frame_Box_default_instance_; + new (ptr) ::libopenshottracker::Frame_Box(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::libopenshottracker::Frame_Box::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Frame_Box_trackerdata_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Frame_Box_trackerdata_2eproto}, {}}; + +static void InitDefaultsscc_info_Tracker_trackerdata_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::libopenshottracker::_Tracker_default_instance_; + new (ptr) ::libopenshottracker::Tracker(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::libopenshottracker::Tracker::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_Tracker_trackerdata_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_Tracker_trackerdata_2eproto}, { + &scc_info_Frame_trackerdata_2eproto.base, + &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base,}}; + +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_trackerdata_2eproto[3]; +static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_trackerdata_2eproto = nullptr; +static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_trackerdata_2eproto = nullptr; + +const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_trackerdata_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame_Box, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame_Box, x1_), + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame_Box, y1_), + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame_Box, x2_), + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame_Box, y2_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame, id_), + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame, rotation_), + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Frame, bounding_box_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Tracker, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Tracker, frame_), + PROTOBUF_FIELD_OFFSET(::libopenshottracker::Tracker, last_updated_), +}; +static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, sizeof(::libopenshottracker::Frame_Box)}, + { 9, -1, sizeof(::libopenshottracker::Frame)}, + { 17, -1, sizeof(::libopenshottracker::Tracker)}, +}; + +static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { + reinterpret_cast(&::libopenshottracker::_Frame_Box_default_instance_), + reinterpret_cast(&::libopenshottracker::_Frame_default_instance_), + reinterpret_cast(&::libopenshottracker::_Tracker_default_instance_), +}; + +const char descriptor_table_protodef_trackerdata_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\021trackerdata.proto\022\022libopenshottracker\032" + "\037google/protobuf/timestamp.proto\"\221\001\n\005Fra" + "me\022\n\n\002id\030\001 \001(\005\022\020\n\010rotation\030\002 \001(\002\0223\n\014boun" + "ding_box\030\003 \001(\0132\035.libopenshottracker.Fram" + "e.Box\0325\n\003Box\022\n\n\002x1\030\001 \001(\005\022\n\n\002y1\030\002 \001(\005\022\n\n\002" + "x2\030\003 \001(\005\022\n\n\002y2\030\004 \001(\005\"e\n\007Tracker\022(\n\005frame" + "\030\001 \003(\0132\031.libopenshottracker.Frame\0220\n\014las" + "t_updated\030\002 \001(\0132\032.google.protobuf.Timest" + "ampb\006proto3" + ; +static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_trackerdata_2eproto_deps[1] = { + &::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_trackerdata_2eproto_sccs[3] = { + &scc_info_Frame_trackerdata_2eproto.base, + &scc_info_Frame_Box_trackerdata_2eproto.base, + &scc_info_Tracker_trackerdata_2eproto.base, +}; +static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_trackerdata_2eproto_once; +const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_trackerdata_2eproto = { + false, false, descriptor_table_protodef_trackerdata_2eproto, "trackerdata.proto", 331, + &descriptor_table_trackerdata_2eproto_once, descriptor_table_trackerdata_2eproto_sccs, descriptor_table_trackerdata_2eproto_deps, 3, 1, + schemas, file_default_instances, TableStruct_trackerdata_2eproto::offsets, + file_level_metadata_trackerdata_2eproto, 3, file_level_enum_descriptors_trackerdata_2eproto, file_level_service_descriptors_trackerdata_2eproto, +}; + +// Force running AddDescriptors() at dynamic initialization time. +static bool dynamic_init_dummy_trackerdata_2eproto = (static_cast(::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_trackerdata_2eproto)), true); +namespace libopenshottracker { + +// =================================================================== + +void Frame_Box::InitAsDefaultInstance() { +} +class Frame_Box::_Internal { + public: +}; + +Frame_Box::Frame_Box(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:libopenshottracker.Frame.Box) +} +Frame_Box::Frame_Box(const Frame_Box& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::memcpy(&x1_, &from.x1_, + static_cast(reinterpret_cast(&y2_) - + reinterpret_cast(&x1_)) + sizeof(y2_)); + // @@protoc_insertion_point(copy_constructor:libopenshottracker.Frame.Box) +} + +void Frame_Box::SharedCtor() { + ::memset(&x1_, 0, static_cast( + reinterpret_cast(&y2_) - + reinterpret_cast(&x1_)) + sizeof(y2_)); +} + +Frame_Box::~Frame_Box() { + // @@protoc_insertion_point(destructor:libopenshottracker.Frame.Box) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void Frame_Box::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); +} + +void Frame_Box::ArenaDtor(void* object) { + Frame_Box* _this = reinterpret_cast< Frame_Box* >(object); + (void)_this; +} +void Frame_Box::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Frame_Box::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const Frame_Box& Frame_Box::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Frame_Box_trackerdata_2eproto.base); + return *internal_default_instance(); +} + + +void Frame_Box::Clear() { +// @@protoc_insertion_point(message_clear_start:libopenshottracker.Frame.Box) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&x1_, 0, static_cast( + reinterpret_cast(&y2_) - + reinterpret_cast(&x1_)) + sizeof(y2_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Frame_Box::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // int32 x1 = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + x1_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // int32 y1 = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + y1_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // int32 x2 = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + x2_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // int32 y2 = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + y2_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Frame_Box::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:libopenshottracker.Frame.Box) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 x1 = 1; + if (this->x1() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_x1(), target); + } + + // int32 y1 = 2; + if (this->y1() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_y1(), target); + } + + // int32 x2 = 3; + if (this->x2() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_x2(), target); + } + + // int32 y2 = 4; + if (this->y2() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_y2(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:libopenshottracker.Frame.Box) + return target; +} + +size_t Frame_Box::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:libopenshottracker.Frame.Box) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // int32 x1 = 1; + if (this->x1() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_x1()); + } + + // int32 y1 = 2; + if (this->y1() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_y1()); + } + + // int32 x2 = 3; + if (this->x2() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_x2()); + } + + // int32 y2 = 4; + if (this->y2() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_y2()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Frame_Box::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:libopenshottracker.Frame.Box) + GOOGLE_DCHECK_NE(&from, this); + const Frame_Box* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:libopenshottracker.Frame.Box) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:libopenshottracker.Frame.Box) + MergeFrom(*source); + } +} + +void Frame_Box::MergeFrom(const Frame_Box& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:libopenshottracker.Frame.Box) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.x1() != 0) { + _internal_set_x1(from._internal_x1()); + } + if (from.y1() != 0) { + _internal_set_y1(from._internal_y1()); + } + if (from.x2() != 0) { + _internal_set_x2(from._internal_x2()); + } + if (from.y2() != 0) { + _internal_set_y2(from._internal_y2()); + } +} + +void Frame_Box::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:libopenshottracker.Frame.Box) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Frame_Box::CopyFrom(const Frame_Box& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:libopenshottracker.Frame.Box) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Frame_Box::IsInitialized() const { + return true; +} + +void Frame_Box::InternalSwap(Frame_Box* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Frame_Box, y2_) + + sizeof(Frame_Box::y2_) + - PROTOBUF_FIELD_OFFSET(Frame_Box, x1_)>( + reinterpret_cast(&x1_), + reinterpret_cast(&other->x1_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Frame_Box::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void Frame::InitAsDefaultInstance() { + ::libopenshottracker::_Frame_default_instance_._instance.get_mutable()->bounding_box_ = const_cast< ::libopenshottracker::Frame_Box*>( + ::libopenshottracker::Frame_Box::internal_default_instance()); +} +class Frame::_Internal { + public: + static const ::libopenshottracker::Frame_Box& bounding_box(const Frame* msg); +}; + +const ::libopenshottracker::Frame_Box& +Frame::_Internal::bounding_box(const Frame* msg) { + return *msg->bounding_box_; +} +Frame::Frame(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:libopenshottracker.Frame) +} +Frame::Frame(const Frame& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + if (from._internal_has_bounding_box()) { + bounding_box_ = new ::libopenshottracker::Frame_Box(*from.bounding_box_); + } else { + bounding_box_ = nullptr; + } + ::memcpy(&id_, &from.id_, + static_cast(reinterpret_cast(&rotation_) - + reinterpret_cast(&id_)) + sizeof(rotation_)); + // @@protoc_insertion_point(copy_constructor:libopenshottracker.Frame) +} + +void Frame::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Frame_trackerdata_2eproto.base); + ::memset(&bounding_box_, 0, static_cast( + reinterpret_cast(&rotation_) - + reinterpret_cast(&bounding_box_)) + sizeof(rotation_)); +} + +Frame::~Frame() { + // @@protoc_insertion_point(destructor:libopenshottracker.Frame) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void Frame::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); + if (this != internal_default_instance()) delete bounding_box_; +} + +void Frame::ArenaDtor(void* object) { + Frame* _this = reinterpret_cast< Frame* >(object); + (void)_this; +} +void Frame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Frame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const Frame& Frame::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Frame_trackerdata_2eproto.base); + return *internal_default_instance(); +} + + +void Frame::Clear() { +// @@protoc_insertion_point(message_clear_start:libopenshottracker.Frame) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (GetArena() == nullptr && bounding_box_ != nullptr) { + delete bounding_box_; + } + bounding_box_ = nullptr; + ::memset(&id_, 0, static_cast( + reinterpret_cast(&rotation_) - + reinterpret_cast(&id_)) + sizeof(rotation_)); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Frame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // int32 id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + // float rotation = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 21)) { + rotation_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr); + ptr += sizeof(float); + } else goto handle_unusual; + continue; + // .libopenshottracker.Frame.Box bounding_box = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_bounding_box(), ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Frame::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:libopenshottracker.Frame) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // int32 id = 1; + if (this->id() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_id(), target); + } + + // float rotation = 2; + if (!(this->rotation() <= 0 && this->rotation() >= 0)) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_rotation(), target); + } + + // .libopenshottracker.Frame.Box bounding_box = 3; + if (this->has_bounding_box()) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::bounding_box(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:libopenshottracker.Frame) + return target; +} + +size_t Frame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:libopenshottracker.Frame) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // .libopenshottracker.Frame.Box bounding_box = 3; + if (this->has_bounding_box()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *bounding_box_); + } + + // int32 id = 1; + if (this->id() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_id()); + } + + // float rotation = 2; + if (!(this->rotation() <= 0 && this->rotation() >= 0)) { + total_size += 1 + 4; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Frame::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:libopenshottracker.Frame) + GOOGLE_DCHECK_NE(&from, this); + const Frame* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:libopenshottracker.Frame) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:libopenshottracker.Frame) + MergeFrom(*source); + } +} + +void Frame::MergeFrom(const Frame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:libopenshottracker.Frame) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.has_bounding_box()) { + _internal_mutable_bounding_box()->::libopenshottracker::Frame_Box::MergeFrom(from._internal_bounding_box()); + } + if (from.id() != 0) { + _internal_set_id(from._internal_id()); + } + if (!(from.rotation() <= 0 && from.rotation() >= 0)) { + _internal_set_rotation(from._internal_rotation()); + } +} + +void Frame::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:libopenshottracker.Frame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Frame::CopyFrom(const Frame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:libopenshottracker.Frame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Frame::IsInitialized() const { + return true; +} + +void Frame::InternalSwap(Frame* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(Frame, rotation_) + + sizeof(Frame::rotation_) + - PROTOBUF_FIELD_OFFSET(Frame, bounding_box_)>( + reinterpret_cast(&bounding_box_), + reinterpret_cast(&other->bounding_box_)); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Frame::GetMetadata() const { + return GetMetadataStatic(); +} + + +// =================================================================== + +void Tracker::InitAsDefaultInstance() { + ::libopenshottracker::_Tracker_default_instance_._instance.get_mutable()->last_updated_ = const_cast< PROTOBUF_NAMESPACE_ID::Timestamp*>( + PROTOBUF_NAMESPACE_ID::Timestamp::internal_default_instance()); +} +class Tracker::_Internal { + public: + static const PROTOBUF_NAMESPACE_ID::Timestamp& last_updated(const Tracker* msg); +}; + +const PROTOBUF_NAMESPACE_ID::Timestamp& +Tracker::_Internal::last_updated(const Tracker* msg) { + return *msg->last_updated_; +} +void Tracker::clear_last_updated() { + if (GetArena() == nullptr && last_updated_ != nullptr) { + delete last_updated_; + } + last_updated_ = nullptr; +} +Tracker::Tracker(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena), + frame_(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:libopenshottracker.Tracker) +} +Tracker::Tracker(const Tracker& from) + : ::PROTOBUF_NAMESPACE_ID::Message(), + frame_(from.frame_) { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + if (from._internal_has_last_updated()) { + last_updated_ = new PROTOBUF_NAMESPACE_ID::Timestamp(*from.last_updated_); + } else { + last_updated_ = nullptr; + } + // @@protoc_insertion_point(copy_constructor:libopenshottracker.Tracker) +} + +void Tracker::SharedCtor() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_Tracker_trackerdata_2eproto.base); + last_updated_ = nullptr; +} + +Tracker::~Tracker() { + // @@protoc_insertion_point(destructor:libopenshottracker.Tracker) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void Tracker::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); + if (this != internal_default_instance()) delete last_updated_; +} + +void Tracker::ArenaDtor(void* object) { + Tracker* _this = reinterpret_cast< Tracker* >(object); + (void)_this; +} +void Tracker::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void Tracker::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const Tracker& Tracker::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Tracker_trackerdata_2eproto.base); + return *internal_default_instance(); +} + + +void Tracker::Clear() { +// @@protoc_insertion_point(message_clear_start:libopenshottracker.Tracker) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + frame_.Clear(); + if (GetArena() == nullptr && last_updated_ != nullptr) { + delete last_updated_; + } + last_updated_ = nullptr; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* Tracker::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // repeated .libopenshottracker.Frame frame = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_frame(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else goto handle_unusual; + continue; + // .google.protobuf.Timestamp last_updated = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_last_updated(), ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* Tracker::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:libopenshottracker.Tracker) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .libopenshottracker.Frame frame = 1; + for (unsigned int i = 0, + n = static_cast(this->_internal_frame_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, this->_internal_frame(i), target, stream); + } + + // .google.protobuf.Timestamp last_updated = 2; + if (this->has_last_updated()) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::last_updated(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:libopenshottracker.Tracker) + return target; +} + +size_t Tracker::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:libopenshottracker.Tracker) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .libopenshottracker.Frame frame = 1; + total_size += 1UL * this->_internal_frame_size(); + for (const auto& msg : this->frame_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // .google.protobuf.Timestamp last_updated = 2; + if (this->has_last_updated()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *last_updated_); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Tracker::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:libopenshottracker.Tracker) + GOOGLE_DCHECK_NE(&from, this); + const Tracker* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:libopenshottracker.Tracker) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:libopenshottracker.Tracker) + MergeFrom(*source); + } +} + +void Tracker::MergeFrom(const Tracker& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:libopenshottracker.Tracker) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + frame_.MergeFrom(from.frame_); + if (from.has_last_updated()) { + _internal_mutable_last_updated()->PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(from._internal_last_updated()); + } +} + +void Tracker::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:libopenshottracker.Tracker) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Tracker::CopyFrom(const Tracker& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:libopenshottracker.Tracker) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Tracker::IsInitialized() const { + return true; +} + +void Tracker::InternalSwap(Tracker* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + frame_.InternalSwap(&other->frame_); + swap(last_updated_, other->last_updated_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata Tracker::GetMetadata() const { + return GetMetadataStatic(); +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace libopenshottracker +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::libopenshottracker::Frame_Box* Arena::CreateMaybeMessage< ::libopenshottracker::Frame_Box >(Arena* arena) { + return Arena::CreateMessageInternal< ::libopenshottracker::Frame_Box >(arena); +} +template<> PROTOBUF_NOINLINE ::libopenshottracker::Frame* Arena::CreateMaybeMessage< ::libopenshottracker::Frame >(Arena* arena) { + return Arena::CreateMessageInternal< ::libopenshottracker::Frame >(arena); +} +template<> PROTOBUF_NOINLINE ::libopenshottracker::Tracker* Arena::CreateMaybeMessage< ::libopenshottracker::Tracker >(Arena* arena) { + return Arena::CreateMessageInternal< ::libopenshottracker::Tracker >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/src/trackerdata.proto b/src/trackerdata.proto new file mode 100644 index 000000000..3511d67a9 --- /dev/null +++ b/src/trackerdata.proto @@ -0,0 +1,29 @@ + +// [START declaration] +syntax = "proto3"; +package libopenshottracker; + +import "google/protobuf/timestamp.proto"; +// [END declaration] + +// [START messages] +message Frame { + int32 id = 1; // Frame ID. + float rotation = 2; + + message Box { + int32 x1 = 1; + int32 y1 = 2; + int32 x2 = 3; + int32 y2 = 4; + } + + Box bounding_box = 3; +} + +message Tracker { + repeated Frame frame = 1; + + google.protobuf.Timestamp last_updated = 2; +} +// [END messages]