75 explicit Roi(std::shared_ptr<peak::afl::Controller> controller)
76 : m_controller{ std::move(controller) }
100 if (value.GetX() < 0 || value.GetY() < 0)
106 m_controller->SetROI(
107 {
static_cast<uint32_t
>(value.GetX()),
static_cast<uint32_t
>(value.GetY()), value.GetWidth(), value.GetHeight() });
128 const auto result = m_controller->GetROI();
129 return {
static_cast<int32_t
>(result.x),
static_cast<int32_t
>(result.y), result.width, result.height };
151 const auto roi =
Get();
152 subArchive->SetInt(
"X", roi.GetX());
153 subArchive->SetInt(
"Y", roi.GetY());
154 subArchive->SetInt(
"Width", roi.GetWidth());
155 subArchive->SetInt(
"Height", roi.GetHeight());
178 const auto subArchive = archive.
GetArchive(
"Roi");
180 const auto x =
static_cast<int32_t
>(subArchive->GetInt(
"X"));
181 const auto y =
static_cast<int32_t
>(subArchive->GetInt(
"Y"));
182 const auto width =
static_cast<uint32_t
>(subArchive->GetInt(
"Width"));
183 const auto height =
static_cast<uint32_t
>(subArchive->GetInt(
"Height"));
185 Set({ x, y, width, height });
196 std::shared_ptr<peak::afl::Controller> m_controller;
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:391
Interface for a hierarchical key-value archive system.
Definition peak_common_iarchive.hpp:59
virtual std::shared_ptr< IArchive > GetArchive(const std::string &key) const =0
Retrieves a nested archive by key.
virtual std::shared_ptr< IArchive > CreateArchive() const =0
Creates a new, empty archive instance.
virtual void SetArchive(const std::string &key, const std::shared_ptr< IArchive > &value)=0
Stores a nested archive object.
Base interface for auto feature implementations.
Definition peak_afl_ifeature.hpp:59
peak::common::Rectangle Get() const override
Gets the current region of interest rectangle.
Definition peak_afl_roi.hpp:126
void Serialize(peak::common::serialization::IArchive &archive) const override
Serializes the current ROI to an archive.
Definition peak_afl_roi.hpp:147
Roi(std::shared_ptr< peak::afl::Controller > controller)
Constructs a Roi feature with the specified controller.
Definition peak_afl_roi.hpp:75
void Deserialize(const peak::common::serialization::IArchive &archive) override
Deserializes the ROI from an archive.
Definition peak_afl_roi.hpp:176
void Set(const peak::common::Rectangle &value) override
Sets the region of interest rectangle.
Definition peak_afl_roi.hpp:98
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:419
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Definition peak_common_defines.h:86
detail::RectangleT< int32_t, uint32_t > Rectangle
Rectangle with integer coordinates and unsigned dimensions.
Definition peak_common_rectangle.hpp:235
Interface definitions and implementations for individual module types used within a pipeline.
Definition peak_afl_generic_auto_brightness.hpp:39
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:37