14#ifdef PEAK_AFL_DYNAMIC_LOADING
15# define PEAK_AFL_C_ABI_PREFIX peak::afl::dynamic::DynamicLoader::
17# define PEAK_AFL_C_ABI_PREFIX
21#include "peak_ipl/types/peak_ipl_image.hpp"
22#include "peak_ipl/algorithm/peak_ipl_gain.hpp"
23#include "peak/node_map/peak_node_map.hpp"
35#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L
36# define PEAK_AFL_NO_DISCARD [[nodiscard]]
37# define PEAK_AFL_MAYBE_UNUSED [[maybe_unused]]
40# define PEAK_AFL_NO_DISCARD _Check_return_
41# define PEAK_AFL_MAYBE_UNUSED
42# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
43# define PEAK_AFL_NO_DISCARD __attribute__((warn_unused_result))
44# define PEAK_AFL_MAYBE_UNUSED __attribute__((unused))
46# define PEAK_AFL_NO_DISCARD
47# define PEAK_AFL_MAYBE_UNUSED
85 PEAK_AFL_NO_DISCARD std::string
ToString()
const
87 return std::to_string(major) +
"." + std::to_string(
minor) +
"." + std::to_string(
subminor) +
"."
88 + std::to_string(
patch);
96 PEAK_AFL_NO_DISCARD uint32_t
Major()
const
106 PEAK_AFL_NO_DISCARD uint32_t
Minor()
const
125 PEAK_AFL_NO_DISCARD uint32_t
Patch()
const
182PEAK_AFL_NO_DISCARD
inline Version_t
Version();
220 PEAK_AFL_NO_DISCARD
const char*
what() const noexcept
override
228 return m_text.c_str();
244 return "PEAK_AFL_STATUS_SUCCESS";
247 return "PEAK_AFL_STATUS_ERROR";
250 return "PEAK_AFL_STATUS_NOT_INITIALIZED";
253 return "PEAK_AFL_STATUS_INVALID_PARAMETER";
256 return "PEAK_AFL_STATUS_ACCESS_DENIED";
259 return "PEAK_AFL_STATUS_BUSY";
262 return "PEAK_AFL_STATUS_BUFFER_TOO_SMALL";
265 return "PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT";
268 return "PEAK_AFL_STATUS_NOT_SUPPORTED";
270 case PEAK_AFL_STATUS_VALUE_ADJUSTED:
271 return "PEAK_AFL_STATUS_VALUE_ADJUSTED";
274 return "Unknown Status code";
280 std::string m_text{};
302 inline explicit Manager(
const std::shared_ptr<peak::core::NodeMap>& node_map);
325 inline void AddController(
const std::shared_ptr<Controller>& controller);
337 inline void RemoveController(
const std::shared_ptr<Controller>& controller);
348 inline void Process(
const peak::ipl::Image& image)
const;
391 inline void SetGainIPL(
const peak::ipl::Gain& gain);
402 PEAK_AFL_NO_DISCARD
inline bool Status()
const;
409 PEAK_AFL_NO_DISCARD
inline std::vector<std::shared_ptr<Controller>>
ControllerList()
const;
430 std::vector<std::shared_ptr<Controller>> m_controllerList;
431 mutable std::mutex m_mutex{};
444template<
typename... ControllerTypes>
445std::tuple<Manager, std::vector<std::shared_ptr<Controller>>>
446CreateManager(
const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
448 constexpr int size =
sizeof...(types);
449 constexpr std::array<peak_afl_controllerType, size> controller_types{types...};
450 std::vector<std::shared_ptr<Controller>> controller{};
452 controller.reserve(size);
454 std::for_each(controller_types.cbegin(), controller_types.cend(), [&manager, &controller](
peak_afl_controllerType type) {
455 controller.emplace_back(std::move(manager.CreateController(type)));
458 return { std::move(manager), std::move(controller) };
466template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value,
int> = 0>
476using FinishedCallback = std::function<void(
void)>;
477using DataProcessingCallback = std::function<void(
int,
int)>;
478using ComponentCallback = std::function<void(
void)>;
480using RegisterFunction = std::function<PEAK_AFL_API_STATUS(
void*,
void*)>;
481using UnRegisterFunction = std::function<void()>;
488class Controller :
public std::enable_shared_from_this<Controller>
497 template<
typename R,
typename ...Args>
498 Callback(
const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
499 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback) :
500 m_callback(std::move(callback)),
501 m_unregister_function(std::move(unregister_function))
503 const auto ret = register_function(
reinterpret_cast<void*
>(&Callback::Func<Args...>),
this);
508 m_controller = controller;
513 if (
auto controller = m_controller.lock())
515 m_unregister_function();
520 template<
typename ...Args>
521 static void Func(Args... args,
void* ptr)
523 static_cast<Callback *
>(ptr)->m_callback(args...);
527 std::weak_ptr<peak::afl::Controller> m_controller{};
528 callback::UnRegisterFunction m_unregister_function{};
541 : m_handle(handle) {};
594 PEAK_AFL_NO_DISCARD
inline std::uint32_t
GetSkipFrames()
const;
722 PEAK_AFL_NO_DISCARD
inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t>
GetLastAutoAverages()
const;
754 PEAK_AFL_NO_DISCARD
inline std::uint32_t
GetAutoTarget()
const;
907 PEAK_AFL_NO_DISCARD
inline std::vector<peak_afl_controller_algorithm>
GetAlgorithmList()
const;
1004 inline void SetWeightedROIs(
const std::vector<peak_afl_weighted_rectangle>& list);
1033 PEAK_AFL_NO_DISCARD
inline std::vector<peak_afl_weighted_rectangle>
GetWeightedROIs()
const;
1104 PEAK_AFL_NO_DISCARD
inline std::uint8_t
GetHysteresis()
const;
1232 using FinishedCallbackType = Callback<callback::FinishedCallback>;
1233 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
1234 using ComponentCallbackType = Callback<callback::ComponentCallback>;
1237 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
1238 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
1239 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
1240 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
1268 const auto ret = PEAK_AFL_C_ABI_PREFIX
peak_afl_GetVersion(&version.major, &version.minor, &version.subminor, &version.patch);
1279 std::size_t lastErrorMessageSize;
1285 return "Cannot get last error!";
1288 std::vector<char> text;
1289 text.resize(lastErrorMessageSize);
1294 return "Cannot get last error!";
1297 return { text.begin(), text.end() };
1305 throw std::runtime_error(
"Invalid node map handle!");
1317 if (m_handle !=
nullptr)
1322 std::lock_guard<std::mutex> lck(m_mutex);
1323 for (
auto& c : m_controllerList)
1325 c->m_handle =
nullptr;
1335 m_handle = other.m_handle;
1336 other.m_handle =
nullptr;
1338 std::lock_guard<std::mutex> lck(other.m_mutex);
1339 m_controllerList = std::move(other.m_controllerList);
1342inline Manager& Manager::operator=(Manager&& other)
noexcept
1344 m_handle = other.m_handle;
1345 other.m_handle =
nullptr;
1347 std::lock_guard<std::mutex> lck(other.m_mutex);
1348 m_controllerList = std::move(other.m_controllerList);
1355 std::lock_guard<std::mutex> lck(m_mutex);
1357 auto cnt = std::any_of(m_controllerList.begin(), m_controllerList.end(), [controller](
const std::shared_ptr<Controller>& c) {
1358 return c == controller;
1372 m_controllerList.emplace_back(controller);
1377 std::lock_guard<std::mutex> lck(m_mutex);
1385 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](
const std::shared_ptr<Controller>& c) {
1386 return c == controller;
1389 m_controllerList.erase(it, m_controllerList.end());
1403 std::lock_guard<std::mutex> lck(m_mutex);
1412 auto shared = std::shared_ptr<Controller>(
new Controller(handle));
1413 m_controllerList.emplace_back(shared);
1420 std::lock_guard<std::mutex> lck(m_mutex);
1428 for(
auto& c : m_controllerList)
1430 c->m_handle =
nullptr;
1433 m_controllerList.clear();
1438 std::lock_guard<std::mutex> lck(m_mutex);
1446 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](
const std::shared_ptr<Controller>& c) {
1447 return c == controller;
1450 m_controllerList.erase(it, m_controllerList.end());
1452 controller->m_handle =
nullptr;
1466 std::uint8_t status;
1478 std::lock_guard<std::mutex> lck(m_mutex);
1480 std::vector<std::shared_ptr<Controller>> controller{};
1482 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
1489 return m_controllerList.size();
1494 std::lock_guard<std::mutex> lck(m_mutex);
1496 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(), [=](
const std::shared_ptr<Controller>& controller) {
1497 return type == controller->Type();
1500 if(it != m_controllerList.cend())
1519 return std::shared_ptr<Controller>(
new Controller(handle));
1524 if (m_handle !=
nullptr)
1554 std::uint32_t count{};
1675 std::uint8_t average{};
1686 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
1692 return { averageRed, averageGreen, averageBlue };
1718 std::uint32_t target{};
1761 std::uint32_t tolerance;
1870 std::vector<peak_afl_controller_algorithm> algList{};
1871 std::uint32_t listSize{};
1879 algList.resize(listSize);
1925 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
1926 std::uint32_t listSize{};
1934 algList.resize(listSize);
1947 m_finishedCallback = std::make_unique<FinishedCallbackType>(shared_from_this(),
1948 [handle = m_handle](
void* ptr,
void* ctx) {
1950 [handle = m_handle] {
1957 m_finishedCallback.reset();
1969 m_finishedExposureCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
1970 [handle = m_handle, component](
void* ptr,
void* ctx) {
1973 [handle = m_handle, component] {
1975 nullptr,
nullptr); },
1980 m_finishedGainCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
1981 [handle = m_handle, component](
void* ptr,
void* ctx) {
1984 [handle = m_handle, component] {
1986 nullptr,
nullptr); },
1999 m_finishedExposureCallback.reset();
2003 m_finishedGainCallback.reset();
2013 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(shared_from_this(),
2014 [handle = m_handle](
void* ptr,
void* ctx) {
2016 [handle = m_handle] {
2023 m_dataProcessingCallback.reset();
2069 std::vector<peak_afl_weighted_rectangle> list;
2070 std::uint32_t listSize{};
2078 list.resize(listSize);
2155 std::uint8_t hysteresis{};
2167 std::uint8_t hysteresis{};
2181 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
2251 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
Definition peak_afl.hpp:489
PEAK_AFL_NO_DISCARD peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:1824
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:1620
PEAK_AFL_NO_DISCARD bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:1781
PEAK_AFL_NO_DISCARD bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:1738
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:2261
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:2248
PEAK_AFL_NO_DISCARD std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:2165
PEAK_AFL_NO_DISCARD std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2153
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:1641
PEAK_AFL_NO_DISCARD bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:1576
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2038
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:1955
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:1564
PEAK_AFL_NO_DISCARD bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:1608
void BrightnessComponentSetMode(peak_afl_controller_brightness_component component, peak_afl_controller_automode mode)
Set the autofeature mode for a brightness controller component.
Definition peak_afl.hpp:2202
PEAK_AFL_NO_DISCARD std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1673
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:2110
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2144
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:2285
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:1543
PEAK_AFL_NO_DISCARD std::vector< peak_afl_controller_sharpness_algorithm > GetSharpnessAlgorithmList() const
Get the list of supported sharpness algorithms for a controller.
Definition peak_afl.hpp:1923
PEAK_AFL_NO_DISCARD peak_afl_controller_automode BrightnessComponentGetMode(peak_afl_controller_brightness_component component) const
Get the current autofeature mode for a brightness controller component.
Definition peak_afl.hpp:2212
PEAK_AFL_NO_DISCARD bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:1629
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:1770
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:1793
PEAK_AFL_NO_DISCARD peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:1597
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:2294
void UnRegisterDataProcessingCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2021
PEAK_AFL_NO_DISCARD std::vector< peak_afl_controller_algorithm > GetAlgorithmList() const
Get the list of supported algorithms for a controller.
Definition peak_afl.hpp:1868
~Controller()
Definition peak_afl.hpp:1522
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:2011
PEAK_AFL_NO_DISCARD bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:1890
PEAK_AFL_NO_DISCARD peak_afl_controller_status BrightnessComponentStatus(peak_afl_controller_brightness_component component) const
Get the status for a brightness controller component.
Definition peak_afl.hpp:2224
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:1995
PEAK_AFL_NO_DISCARD std::tuple< std::uint8_t, std::uint8_t, std::uint8_t > GetLastAutoAverages() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1684
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:1759
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:1847
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:1588
PEAK_AFL_NO_DISCARD bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:1531
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:2121
PEAK_AFL_NO_DISCARD bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:2089
PEAK_AFL_NO_DISCARD peak_afl_size GetWeightedROIMinSize() const
Get the autofeature minimum size of weighted region of interest for a controller.
Definition peak_afl.hpp:2056
PEAK_AFL_NO_DISCARD peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:1650
static PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:1510
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:1945
PEAK_AFL_NO_DISCARD peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:1856
PEAK_AFL_NO_DISCARD bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:2236
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:2273
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2047
PEAK_AFL_NO_DISCARD std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:1552
PEAK_AFL_NO_DISCARD peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:1911
PEAK_AFL_NO_DISCARD peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:1661
PEAK_AFL_NO_DISCARD bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:1835
PEAK_AFL_NO_DISCARD Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:1813
PEAK_AFL_NO_DISCARD double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:1802
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:1707
PEAK_AFL_NO_DISCARD bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:2190
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:1750
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:1716
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:1727
PEAK_AFL_NO_DISCARD Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:2177
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:2101
PEAK_AFL_NO_DISCARD bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:2026
PEAK_AFL_NO_DISCARD bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:2132
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:1960
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:1902
PEAK_AFL_NO_DISCARD bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:1695
PEAK_AFL_NO_DISCARD std::vector< peak_afl_weighted_rectangle > GetWeightedROIs() const
Get the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2067
Definition peak_afl.hpp:291
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:1301
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:1375
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:1492
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:1418
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:1436
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > CreateController(peak_afl_controllerType type)
Create a controller and append it to Manager.
Definition peak_afl.hpp:1401
PEAK_AFL_NO_DISCARD size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:1487
PEAK_AFL_NO_DISCARD bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:1464
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:1315
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:1455
PEAK_AFL_NO_DISCARD std::vector< std::shared_ptr< Controller > > ControllerList() const
Get the list of the controller associated with the manager.
Definition peak_afl.hpp:1476
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:1353
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:1392
Definition peak_afl.hpp:194
PEAK_AFL_NO_DISCARD const char * what() const noexcept override
Get the string representation for the exception.
Definition peak_afl.hpp:220
static PEAK_AFL_NO_DISCARD std::string translateCode(peak_afl_status status)
Get a string representation for an error code.
Definition peak_afl.hpp:239
PEAK_AFL_NO_DISCARD peak_afl_status code() const
Get the return code for the failure.
Definition peak_afl.hpp:210
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the auto target range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Default(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature default limit.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_GetRange(peak_afl_controller_handle controller, double *min, double *max, double *inc)
Get the auto percentile range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Callback_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get range for frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Default(peak_afl_controller_handle controller, uint8_t *hysteresis)
Get the autofeature hysteresis default.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_automode *mode)
Get the current autofeature mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto percentile is supported for a controller.
peak_afl_controllerType
controller types
Definition peak_afl.h:125
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Status(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_status *status)
Get the status for a controller component.
peak_afl_controller_brightness_component
controller brightness component
Definition peak_afl.h:232
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_algorithm *algorithm)
Get the used algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_automode *mode)
Get the current brightness component mode for a controller.
peak_afl_controller_automode
controller automode
Definition peak_afl.h:144
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto target is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Get(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Status(peak_afl_controller_handle controller, peak_afl_controller_status *status)
Get the status for a controller.
peak_afl_roi_preset
controller roi preset
Definition peak_afl.h:287
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_Get(peak_afl_controller_handle controller, uint32_t *target)
Get the currently set auto target for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_GetList(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *typeList, uint32_t *listSize)
Get the list of supported sharpness algorithms for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Set(peak_afl_controller_handle controller, uint32_t count)
Set number of frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Get(peak_afl_controller_handle controller, uint32_t *count)
Get number of frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_Set(peak_afl_controller_handle controller, uint32_t tolerance)
Set the auto tolerance for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Set(peak_afl_controller_handle controller, const peak_afl_weighted_rectangle *weightedRoiList, uint32_t listSize)
Set the autofeature weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_Set(peak_afl_controller_handle controller, peak_afl_roi_preset roiPreset)
Set the autofeature region of interest preset for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Set(peak_afl_controller_handle controller, uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Get(peak_afl_controller_handle controller, peak_afl_weighted_rectangle *weightedRoiList, uint32_t *listSize)
Get the autofeature weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if auto mode is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if skip frames is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Set(peak_afl_controller_handle controller, peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Get(peak_afl_controller_handle controller, peak_afl_rectangle *roi)
Get the autofeature region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature exposure limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Callback_Set(peak_afl_controller_handle controller, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Get(peak_afl_controller_handle controller, uint8_t *hysteresis)
Get the autofeature hysteresis for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if hysteresis is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if ROI preset is supported for a controller.
peak_afl_controller_status
controller status
Definition peak_afl.h:160
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto tolerance is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature exposure limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Create(peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a new controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_automode mode)
Set the autofeature mode for a brightness component.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Min_Size(peak_afl_controller_handle controller, peak_afl_size *size)
Get the autofeature minimum size for the weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if weighted region of interest is supported for a controller.
peak_afl_controller_algorithm
controller algorithm
Definition peak_afl.h:188
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_Set(peak_afl_controller_handle controller, double percentile)
Set the auto percentile for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if setting an algorithm is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if limit is supported for a controller.
peak_afl_controller_sharpness_algorithm
controller sharpness algorithm (focus)
Definition peak_afl.h:210
PEAK_AFL_API_STATUS peak_afl_AutoController_GetLastAutoAverage(peak_afl_controller_handle controller, uint8_t *average)
Get the last auto average for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GetLastAutoAverages(peak_afl_controller_handle controller, uint8_t *averageRed, uint8_t *averageGreen, uint8_t *averageBlue)
Get the last auto average for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_Set(peak_afl_controller_handle controller, uint32_t target)
Set the auto target for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Set(peak_afl_controller_handle controller, peak_afl_rectangle roi)
Set the autofeature region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Type_Get(peak_afl_controller_handle controller, peak_afl_controllerType *type)
Get the controller type.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_GetRange(peak_afl_controller_handle controller, uint8_t *min, uint8_t *max, uint8_t *inc)
Get autofeature hysteresis range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Destroy(peak_afl_controller_handle controller)
Destroy a controller. Will fail if it is queued inside a manager.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the auto tolerance range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_GetList(peak_afl_controller_handle controller, peak_afl_controller_algorithm *typeList, uint32_t *listSize)
Get the list of supported algorithms for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_Get(peak_afl_controller_handle controller, uint32_t *tolerance)
Get the current auto tolerance for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_Get(peak_afl_controller_handle controller, double *percentile)
Get the auto percentile for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *algorithm)
Get the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if setting a region of interest is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if brightness component mode is supported for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check setting a sharpness algorithm is supported by a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Set(peak_afl_controller_handle controller, peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if gain limit is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature gain limit for a controller.
@ PEAK_AFL_CONTROLLER_CALLBACK_FINISHED
Controller callback type finished.
Definition peak_afl.h:264
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA
Controller callback type processing data.
Definition peak_afl.h:267
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_GAIN
gain
Definition peak_afl.h:237
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_EXPOSURE
exposure
Definition peak_afl.h:234
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Create(peak_afl_manager_handle *handle, PEAK_NODE_MAP_HANDLE nodeMapHandle)
Create an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_CreateController(peak_afl_manager_handle handle, peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a controller and append it to Manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Process(peak_afl_manager_handle handle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Process an image.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyController(peak_afl_manager_handle handle, peak_afl_controller_handle controller)
Destroy a controller.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Status(peak_afl_manager_handle handle, peak_afl_BOOL8 *running)
Get the status of a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Destroy(peak_afl_manager_handle handle)
Destroy an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyAllController(peak_afl_manager_handle handle)
Destroy all controllers for a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_AddController(peak_afl_manager_handle handle, peak_afl_manager_handle controller)
Add a controller to an auto manager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_RemoveController(peak_afl_manager_handle handle, peak_afl_manager_handle controller)
Remove a controller to an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_SetGainIPL(peak_afl_manager_handle handle, PEAK_IPL_GAIN_HANDLE gainHandle)
Set the IPL Gain.
void Exit()
Exit the peak_afl auto feature library.
Definition peak_afl.hpp:1255
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:1245
PEAK_AFL_NO_DISCARD std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:1277
PEAK_AFL_NO_DISCARD Version_t Version()
Query the library version.
Definition peak_afl.hpp:1264
std::tuple< Manager, std::vector< std::shared_ptr< Controller > > > CreateManager(const std::shared_ptr< peak::core::NodeMap > &node_map, ControllerTypes... types)
Convenience function to create a manager with the supplied controllers.
Definition peak_afl.hpp:446
PEAK_AFL_API_STATUS peak_afl_Init(void)
Init the peak_afl auto feature library.
PEAK_AFL_API_STATUS peak_afl_Exit(void)
Exit the peak_afl auto feature library.
PEAK_AFL_API_STATUS peak_afl_GetVersion(uint32_t *majorVersion, uint32_t *minorVersion, uint32_t *subminorVersion, uint32_t *patchVersion)
Query the library version.
PEAK_AFL_API_STATUS peak_afl_GetLastError(peak_afl_status *lastErrorCode, char *lastErrorMessage, size_t *lastErrorMessageSize)
Get the last error message.
peak_afl_status
peak_afl Status codes
Definition peak_afl.h:88
@ PEAK_AFL_STATUS_SUCCESS
Success.
Definition peak_afl.h:90
@ PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT
Invalid image format.
Definition peak_afl.h:111
@ PEAK_AFL_STATUS_ACCESS_DENIED
Access Denied.
Definition peak_afl.h:102
@ PEAK_AFL_STATUS_BUSY
Busy.
Definition peak_afl.h:105
@ PEAK_AFL_STATUS_NOT_SUPPORTED
Not supported.
Definition peak_afl.h:114
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid Parameter.
Definition peak_afl.h:99
@ PEAK_AFL_STATUS_BUFFER_TOO_SMALL
Buffer too small.
Definition peak_afl.h:108
@ PEAK_AFL_STATUS_NOT_INITIALIZED
Library not initialized.
Definition peak_afl.h:96
@ PEAK_AFL_STATUS_ERROR
Error.
Definition peak_afl.h:93
void * peak_afl_controller_handle
opaque controller handle type
Definition peak_afl.h:49
void * peak_afl_manager_handle
opaque manager handle type
Definition peak_afl.h:51
uint8_t peak_afl_BOOL8
custom boolean type
Definition peak_afl.h:397
Definition peak_afl.hpp:468
Definition peak_afl.hpp:75
PEAK_AFL_NO_DISCARD uint32_t Minor() const
Returns the minor part of the version which is the second part of the version scheme separated by dot...
Definition peak_afl.hpp:106
std::uint32_t minor
Major.
Definition peak_afl.hpp:77
std::uint32_t subminor
Minor.
Definition peak_afl.hpp:78
PEAK_AFL_NO_DISCARD std::string ToString() const
Patch.
Definition peak_afl.hpp:85
PEAK_AFL_NO_DISCARD uint32_t Subminor() const
Returns the subminor part of the version which is the third part of the version scheme separated by d...
Definition peak_afl.hpp:115
PEAK_AFL_NO_DISCARD uint32_t Major() const
Returns the major part of the version which is the first part of the version scheme separated by dots...
Definition peak_afl.hpp:96
std::uint32_t patch
Subminor.
Definition peak_afl.hpp:79
PEAK_AFL_NO_DISCARD uint32_t Patch() const
Returns the patch part of the version which is the fourth part of the version scheme separated by dot...
Definition peak_afl.hpp:125
peak_afl Focus Limit
Definition peak_afl.h:373
peak_afl Double Limit
Definition peak_afl.h:389
peak_afl Rectangle (2D)
Definition peak_afl.h:335
peak_afl Size (2D)
Definition peak_afl.h:301
peak_afl Focus Rectangle
Definition peak_afl.h:357