14#include "peak_ipl/types/peak_ipl_image.hpp"
15#include "peak_ipl/algorithm/peak_ipl_gain.hpp"
16#include "peak/node_map/peak_node_map.hpp"
28#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L
29# define PEAK_AFL_NO_DISCARD [[nodiscard]]
30# define PEAK_AFL_MAYBE_UNUSED [[maybe_unused]]
33# define PEAK_AFL_NO_DISCARD _Check_return_
34# define PEAK_AFL_MAYBE_UNUSED
35# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
36# define PEAK_AFL_NO_DISCARD __attribute__((warn_unused_result))
37# define PEAK_AFL_MAYBE_UNUSED __attribute__((unused))
39# define PEAK_AFL_NO_DISCARD
40# define PEAK_AFL_MAYBE_UNUSED
78 PEAK_AFL_NO_DISCARD std::string
ToString()
const
80 return std::to_string(major) +
"." + std::to_string(
minor) +
"." + std::to_string(
subminor) +
"."
81 + std::to_string(
patch);
89 PEAK_AFL_NO_DISCARD uint32_t
Major()
const
99 PEAK_AFL_NO_DISCARD uint32_t
Minor()
const
118 PEAK_AFL_NO_DISCARD uint32_t
Patch()
const
175PEAK_AFL_NO_DISCARD
inline Version_t
Version();
213 PEAK_AFL_NO_DISCARD
const char*
what() const noexcept
override
221 return m_text.c_str();
237 return "PEAK_AFL_STATUS_SUCCESS";
240 return "PEAK_AFL_STATUS_ERROR";
243 return "PEAK_AFL_STATUS_NOT_INITIALIZED";
246 return "PEAK_AFL_STATUS_INVALID_PARAMETER";
249 return "PEAK_AFL_STATUS_ACCESS_DENIED";
252 return "PEAK_AFL_STATUS_BUSY";
255 return "PEAK_AFL_STATUS_BUFFER_TOO_SMALL";
258 return "PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT";
261 return "PEAK_AFL_STATUS_NOT_SUPPORTED";
263 case PEAK_AFL_STATUS_VALUE_ADJUSTED:
264 return "PEAK_AFL_STATUS_VALUE_ADJUSTED";
267 return "Unknown Status code";
273 std::string m_text{};
295 inline explicit Manager(
const std::shared_ptr<peak::core::NodeMap>& node_map);
318 inline void AddController(
const std::shared_ptr<Controller>& controller);
330 inline void RemoveController(
const std::shared_ptr<Controller>& controller);
341 inline void Process(
const peak::ipl::Image& image)
const;
384 inline void SetGainIPL(
const peak::ipl::Gain& gain);
395 PEAK_AFL_NO_DISCARD
inline bool Status()
const;
402 PEAK_AFL_NO_DISCARD
inline std::vector<std::shared_ptr<Controller>>
ControllerList()
const;
423 std::vector<std::shared_ptr<Controller>> m_controllerList;
424 mutable std::mutex m_mutex{};
437template<
typename... ControllerTypes>
438std::tuple<Manager, std::vector<std::shared_ptr<Controller>>>
439CreateManager(
const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
441 constexpr int size =
sizeof...(types);
442 constexpr std::array<peak_afl_controllerType, size> controller_types{types...};
443 std::vector<std::shared_ptr<Controller>> controller{};
445 controller.reserve(size);
447 std::for_each(controller_types.cbegin(), controller_types.cend(), [&manager, &controller](
peak_afl_controllerType type) {
448 controller.emplace_back(std::move(manager.CreateController(type)));
451 return { std::move(manager), std::move(controller) };
459template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value,
int> = 0>
469using FinishedCallback = std::function<void(
void)>;
470using DataProcessingCallback = std::function<void(
int,
int)>;
471using ComponentCallback = std::function<void(
void)>;
473using RegisterFunction = std::function<PEAK_AFL_API_STATUS(
void*,
void*)>;
474using UnRegisterFunction = std::function<void()>;
481class Controller :
public std::enable_shared_from_this<Controller>
490 template<
typename R,
typename ...Args>
491 Callback(
const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
492 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback) :
493 m_callback(std::move(callback)),
494 m_unregister_function(std::move(unregister_function))
496 const auto ret = register_function(
reinterpret_cast<void*
>(&Callback::Func<Args...>),
this);
501 m_controller = controller;
506 if (
auto controller = m_controller.lock())
508 m_unregister_function();
513 template<
typename ...Args>
514 static void Func(Args... args,
void* ptr)
516 static_cast<Callback *
>(ptr)->m_callback(args...);
520 std::weak_ptr<peak::afl::Controller> m_controller{};
521 callback::UnRegisterFunction m_unregister_function{};
534 : m_handle(handle) {};
587 PEAK_AFL_NO_DISCARD
inline std::uint32_t
GetSkipFrames()
const;
715 PEAK_AFL_NO_DISCARD
inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t>
GetLastAutoAverages()
const;
747 PEAK_AFL_NO_DISCARD
inline std::uint32_t
GetAutoTarget()
const;
900 PEAK_AFL_NO_DISCARD
inline std::vector<peak_afl_controller_algorithm>
GetAlgorithmList()
const;
997 inline void SetWeightedROIs(
const std::vector<peak_afl_weighted_rectangle>& list);
1026 PEAK_AFL_NO_DISCARD
inline std::vector<peak_afl_weighted_rectangle>
GetWeightedROIs()
const;
1097 PEAK_AFL_NO_DISCARD
inline std::uint8_t
GetHysteresis()
const;
1225 using FinishedCallbackType = Callback<callback::FinishedCallback>;
1226 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
1227 using ComponentCallbackType = Callback<callback::ComponentCallback>;
1230 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
1231 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
1232 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
1233 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
1261 const auto ret =
peak_afl_GetVersion(&version.major, &version.minor, &version.subminor, &version.patch);
1272 std::size_t lastErrorMessageSize;
1278 return "Cannot get last error!";
1281 std::vector<char> text;
1282 text.resize(lastErrorMessageSize);
1287 return "Cannot get last error!";
1290 return { text.begin(), text.end() };
1298 throw std::runtime_error(
"Invalid node map handle!");
1310 if (m_handle !=
nullptr)
1315 std::lock_guard<std::mutex> lck(m_mutex);
1316 for (
auto& c : m_controllerList)
1318 c->m_handle =
nullptr;
1328 m_handle = other.m_handle;
1329 other.m_handle =
nullptr;
1331 std::lock_guard<std::mutex> lck(other.m_mutex);
1332 m_controllerList = std::move(other.m_controllerList);
1335inline Manager& Manager::operator=(Manager&& other)
noexcept
1337 m_handle = other.m_handle;
1338 other.m_handle =
nullptr;
1340 std::lock_guard<std::mutex> lck(other.m_mutex);
1341 m_controllerList = std::move(other.m_controllerList);
1348 std::lock_guard<std::mutex> lck(m_mutex);
1350 auto cnt = std::any_of(m_controllerList.begin(), m_controllerList.end(), [controller](
const std::shared_ptr<Controller>& c) {
1351 return c == controller;
1365 m_controllerList.emplace_back(controller);
1370 std::lock_guard<std::mutex> lck(m_mutex);
1378 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](
const std::shared_ptr<Controller>& c) {
1379 return c == controller;
1382 m_controllerList.erase(it, m_controllerList.end());
1396 std::lock_guard<std::mutex> lck(m_mutex);
1405 auto shared = std::shared_ptr<Controller>(
new Controller(handle));
1406 m_controllerList.emplace_back(shared);
1413 std::lock_guard<std::mutex> lck(m_mutex);
1421 for(
auto& c : m_controllerList)
1423 c->m_handle =
nullptr;
1426 m_controllerList.clear();
1431 std::lock_guard<std::mutex> lck(m_mutex);
1439 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](
const std::shared_ptr<Controller>& c) {
1440 return c == controller;
1443 m_controllerList.erase(it, m_controllerList.end());
1445 controller->m_handle =
nullptr;
1459 std::uint8_t status;
1471 std::lock_guard<std::mutex> lck(m_mutex);
1473 std::vector<std::shared_ptr<Controller>> controller{};
1475 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
1482 return m_controllerList.size();
1487 std::lock_guard<std::mutex> lck(m_mutex);
1489 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(), [=](
const std::shared_ptr<Controller>& controller) {
1490 return type == controller->Type();
1493 if(it != m_controllerList.cend())
1512 return std::shared_ptr<Controller>(
new Controller(handle));
1517 if (m_handle !=
nullptr)
1547 std::uint32_t count{};
1668 std::uint8_t average{};
1679 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
1685 return { averageRed, averageGreen, averageBlue };
1711 std::uint32_t target{};
1754 std::uint32_t tolerance;
1863 std::vector<peak_afl_controller_algorithm> algList{};
1864 std::uint32_t listSize{};
1872 algList.resize(listSize);
1918 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
1919 std::uint32_t listSize{};
1927 algList.resize(listSize);
1940 m_finishedCallback = std::make_unique<FinishedCallbackType>(shared_from_this(),
1941 [handle = m_handle](
void* ptr,
void* ctx) {
1943 [handle = m_handle] {
1950 m_finishedCallback.reset();
1962 m_finishedExposureCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
1963 [handle = m_handle, component](
void* ptr,
void* ctx) {
1966 [handle = m_handle, component] {
1968 nullptr,
nullptr); },
1973 m_finishedGainCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
1974 [handle = m_handle, component](
void* ptr,
void* ctx) {
1977 [handle = m_handle, component] {
1979 nullptr,
nullptr); },
1992 m_finishedExposureCallback.reset();
1996 m_finishedGainCallback.reset();
2006 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(shared_from_this(),
2007 [handle = m_handle](
void* ptr,
void* ctx) {
2009 [handle = m_handle] {
2016 m_dataProcessingCallback.reset();
2062 std::vector<peak_afl_weighted_rectangle> list;
2063 std::uint32_t listSize{};
2071 list.resize(listSize);
2148 std::uint8_t hysteresis{};
2160 std::uint8_t hysteresis{};
2174 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
2244 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
Definition peak_afl.hpp:482
PEAK_AFL_NO_DISCARD peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:1817
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:1613
PEAK_AFL_NO_DISCARD bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:1774
PEAK_AFL_NO_DISCARD bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:1731
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:2254
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:2241
PEAK_AFL_NO_DISCARD std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:2158
PEAK_AFL_NO_DISCARD std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2146
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:1634
PEAK_AFL_NO_DISCARD bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:1569
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2031
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:1948
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:1557
PEAK_AFL_NO_DISCARD bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:1601
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:2195
PEAK_AFL_NO_DISCARD std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1666
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:2103
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2137
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:2278
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:1536
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:1916
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:2205
PEAK_AFL_NO_DISCARD bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:1622
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:1763
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:1786
PEAK_AFL_NO_DISCARD peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:1590
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:2287
void UnRegisterDataProcessingCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2014
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:1861
~Controller()
Definition peak_afl.hpp:1515
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:2004
PEAK_AFL_NO_DISCARD bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:1883
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:2217
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:1988
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:1677
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:1752
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:1840
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:1581
PEAK_AFL_NO_DISCARD bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:1524
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:2114
PEAK_AFL_NO_DISCARD bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:2082
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:2049
PEAK_AFL_NO_DISCARD peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:1643
static PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:1503
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:1938
PEAK_AFL_NO_DISCARD peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:1849
PEAK_AFL_NO_DISCARD bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:2229
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:2266
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2040
PEAK_AFL_NO_DISCARD std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:1545
PEAK_AFL_NO_DISCARD peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:1904
PEAK_AFL_NO_DISCARD peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:1654
PEAK_AFL_NO_DISCARD bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:1828
PEAK_AFL_NO_DISCARD Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:1806
PEAK_AFL_NO_DISCARD double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:1795
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:1700
PEAK_AFL_NO_DISCARD bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:2183
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:1743
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:1709
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:1720
PEAK_AFL_NO_DISCARD Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:2170
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:2094
PEAK_AFL_NO_DISCARD bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:2019
PEAK_AFL_NO_DISCARD bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:2125
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:1953
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:1895
PEAK_AFL_NO_DISCARD bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:1688
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:2060
Definition peak_afl.hpp:284
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:1294
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:1368
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:1485
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:1411
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:1429
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:1394
PEAK_AFL_NO_DISCARD size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:1480
PEAK_AFL_NO_DISCARD bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:1457
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:1308
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:1448
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:1469
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:1346
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:1385
Definition peak_afl.hpp:187
PEAK_AFL_NO_DISCARD const char * what() const noexcept override
Get the string representation for the exception.
Definition peak_afl.hpp:213
static PEAK_AFL_NO_DISCARD std::string translateCode(peak_afl_status status)
Get a string representation for an error code.
Definition peak_afl.hpp:232
PEAK_AFL_NO_DISCARD peak_afl_status code() const
Get the return code for the failure.
Definition peak_afl.hpp:203
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:1248
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:1238
PEAK_AFL_NO_DISCARD std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:1270
PEAK_AFL_NO_DISCARD Version_t Version()
Query the library version.
Definition peak_afl.hpp:1257
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:439
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:461
Definition peak_afl.hpp:68
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:99
std::uint32_t minor
Major.
Definition peak_afl.hpp:70
std::uint32_t subminor
Minor.
Definition peak_afl.hpp:71
PEAK_AFL_NO_DISCARD std::string ToString() const
Patch.
Definition peak_afl.hpp:78
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:108
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:89
std::uint32_t patch
Subminor.
Definition peak_afl.hpp:72
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:118
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