IDS peak AFL v2.0.2
Loading...
Searching...
No Matches
peak_afl.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
13
14#ifdef PEAK_AFL_DYNAMIC_LOADING
15# define PEAK_AFL_C_ABI_PREFIX peak::afl::dynamic::DynamicLoader::
16#else
17# define PEAK_AFL_C_ABI_PREFIX // we could also set ::
18#endif
19
20#include <peak_afl/peak_afl.h>
22#include <peak_ipl/algorithm/peak_ipl_gain.hpp>
23#include <peak_ipl/types/peak_ipl_image.hpp>
24#include <peak/node_map/peak_node_map.hpp>
25
26#include <type_traits>
27#include <array>
28#include <cstdint>
29#include <exception>
30#include <functional>
31#include <memory>
32#include <string>
33#include <tuple>
34#include <utility>
35#include <vector>
36
37#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))
38# define PEAK_AFL_NO_DISCARD [[nodiscard]]
39# define PEAK_AFL_MAYBE_UNUSED [[maybe_unused]]
40#else
41# ifdef _MSC_VER
42# define PEAK_AFL_NO_DISCARD _Check_return_
43# define PEAK_AFL_MAYBE_UNUSED
44# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
45# define PEAK_AFL_NO_DISCARD __attribute__((warn_unused_result))
46# define PEAK_AFL_MAYBE_UNUSED __attribute__((unused))
47# else
48# define PEAK_AFL_NO_DISCARD
49# define PEAK_AFL_MAYBE_UNUSED
50# endif
51#endif
52
57
64
71
78
85
94
103
110
117
118
119namespace peak
120{
121namespace afl
122{
123namespace library
124{
125
131{
132 std::uint32_t major;
133 std::uint32_t minor;
134 std::uint32_t subminor;
135 std::uint32_t patch;
136
141 PEAK_AFL_NO_DISCARD std::string ToString() const
142 {
143 return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(subminor) + "." + std::to_string(patch);
144 }
145
151 PEAK_AFL_NO_DISCARD uint32_t Major() const
152 {
153 return major;
154 }
155
161 PEAK_AFL_NO_DISCARD uint32_t Minor() const
162 {
163 return minor;
164 }
165
170 PEAK_AFL_NO_DISCARD uint32_t Subminor() const
171 {
172 return subminor;
173 }
174
180 PEAK_AFL_NO_DISCARD uint32_t Patch() const
181 {
182 return patch;
183 }
184};
185
201inline void Init();
202
218inline void Exit();
219
228PEAK_AFL_NO_DISCARD inline std::string GetLastError();
229
244PEAK_AFL_NO_DISCARD inline Version_t Version();
245} // namespace library
246
247
248namespace error
249{
250
255class Exception : public virtual peak::common::Exception
256{
257public:
258 explicit Exception(const std::string& string, peak_afl_status code)
260 , m_code(code)
261 {}
262
263 explicit Exception(const char* string, peak_afl_status code)
265 , m_code(code)
266 {}
267
275 PEAK_AFL_NO_DISCARD peak_afl_status code() const
276 {
277 return m_code;
278 }
279
289 PEAK_AFL_NO_DISCARD static std::string translateCode(peak_afl_status status)
290 {
291 switch (status)
292 {
294 return "PEAK_AFL_STATUS_SUCCESS";
295
297 return "PEAK_AFL_STATUS_ERROR";
298
300 return "PEAK_AFL_STATUS_NOT_INITIALIZED";
301
303 return "PEAK_AFL_STATUS_INVALID_PARAMETER";
304
306 return "PEAK_AFL_STATUS_ACCESS_DENIED";
307
309 return "PEAK_AFL_STATUS_BUSY";
310
312 return "PEAK_AFL_STATUS_BUFFER_TOO_SMALL";
313
315 return "PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT";
316
318 return "PEAK_AFL_STATUS_NOT_SUPPORTED";
319
321 return "PEAK_AFL_STATUS_VALUE_ADJUSTED";
322 }
323
324 return "Unknown Status code";
325 }
326
327private:
328 peak_afl_status m_code{};
329};
330
337class InternalErrorException
338 : public Exception
340{
341public:
342 explicit InternalErrorException(const std::string& string, peak_afl_status code)
344 , Exception(string, code)
346 {}
347
348 explicit InternalErrorException(const char* string, peak_afl_status code)
350 , Exception(string, code)
352 {}
353};
354
361class NotInitializedException
362 : public Exception
364{
365public:
366 explicit NotInitializedException(const std::string& string, peak_afl_status code)
368 , Exception(string, code)
370 {}
371
372 explicit NotInitializedException(const char* string, peak_afl_status code)
374 , Exception(string, code)
376 {}
377};
378
388class InvalidParameterException
389 : public Exception
391{
392public:
393 explicit InvalidParameterException(const std::string& string, peak_afl_status code)
395 , Exception(string, code)
397 {}
398
399 explicit InvalidParameterException(const char* string, peak_afl_status code)
401 , Exception(string, code)
403 {}
404};
405
413class NotSupportedException
414 : public Exception
416{
417public:
418 explicit NotSupportedException(const std::string& string, peak_afl_status code)
420 , Exception(string, code)
422 {}
423
424 explicit NotSupportedException(const char* string, peak_afl_status code)
426 , Exception(string, code)
428 {}
429};
430
437class BusyException : public Exception
438{
439public:
440 explicit BusyException(const std::string& string, peak_afl_status code)
442 , Exception(string, code)
443 {}
444
445 explicit BusyException(const char* string, peak_afl_status code)
447 , Exception(string, code)
448 {}
449};
450
460class InvalidImageFormatException : public Exception
461{
462public:
463 explicit InvalidImageFormatException(const std::string& string, peak_afl_status code)
465 , Exception(string, code)
466 {}
467
468 explicit InvalidImageFormatException(const char* string, peak_afl_status code)
470 , Exception(string, code)
471 {}
472};
473
481class BadAccessException : public Exception
482{
483public:
484 explicit BadAccessException(const std::string& string, peak_afl_status code)
486 , Exception(string, code)
487 {}
488
489 explicit BadAccessException(const char* string, peak_afl_status code)
491 , Exception(string, code)
492 {}
493};
494
501class BufferTooSmallException : public Exception
502{
503public:
504 explicit BufferTooSmallException(const std::string& string, peak_afl_status code)
506 , Exception(string, code)
507 {}
508
509 explicit BufferTooSmallException(const char* string, peak_afl_status code)
511 , Exception(string, code)
512 {}
513};
514
521class CorruptedDataException : public Exception
522{
523public:
524 explicit CorruptedDataException(const std::string& string, peak_afl_status code)
526 , Exception(string, code)
527 {}
528
529 explicit CorruptedDataException(const char* string, peak_afl_status code)
531 , Exception(string, code)
532 {}
533};
534
539class InvalidCastException
540 : public Exception
542{
543public:
544 explicit InvalidCastException(const std::string& string, peak_afl_status code)
546 , Exception(string, code)
548 {}
549
550 explicit InvalidCastException(const char* string, peak_afl_status code)
552 , Exception(string, code)
554 {}
555};
556
567static void ThrowException(peak_afl_status code, bool get_text = true)
568{
569 const auto text = get_text ? library::GetLastError() : "No additional text";
570
571 switch (code)
572 {
574 throw InternalErrorException(text, code);
575
577 throw NotInitializedException(text, code);
578
580 throw InvalidParameterException(text, code);
581
583 throw BadAccessException(text, code);
584
586 throw BusyException(text, code);
587
589 throw BufferTooSmallException(text, code);
590
592 throw InvalidImageFormatException(text, code);
593
595 throw NotSupportedException(text, code);
596
599 break;
600 }
601}
602
603} // namespace error
604
605class Controller;
606
663{
664public:
676 inline explicit Manager(const std::shared_ptr<peak::core::NodeMap>& node_map);
677
681 inline ~Manager();
682
683 Manager(const Manager&) = delete;
684 inline Manager(Manager&&) noexcept;
685
686 Manager& operator=(const Manager&) noexcept = delete;
687 inline Manager& operator=(Manager&&) noexcept;
688
701 inline void AddController(const std::shared_ptr<Controller>& controller);
702
715 inline void RemoveController(const std::shared_ptr<Controller>& controller);
716
728 inline void Process(const peak::ipl::Image& image) const;
729
744 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> CreateController(peak_afl_controllerType type);
745
755 inline void DestroyAllController();
756
766 inline void DestroyController(const std::shared_ptr<Controller>& controller);
767
777 inline void SetGainIPL(const peak::ipl::Gain& gain);
778
799 inline void SetCCM(std::array<float, 9> ccm);
800
812 PEAK_AFL_NO_DISCARD inline bool Status() const;
813
821 PEAK_AFL_NO_DISCARD inline std::vector<std::shared_ptr<Controller>> ControllerList() const;
822
830 PEAK_AFL_NO_DISCARD inline size_t ControllerCount() const;
831
843 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> GetController(peak_afl_controllerType type) const;
844
854 PEAK_AFL_NO_DISCARD inline bool IsControllerSupported(peak_afl_controllerType type) const;
855
856private:
857 std::vector<std::shared_ptr<Controller>> m_controllerList;
858 mutable std::mutex m_mutex{};
859 peak_afl_manager_handle m_handle{};
860};
861
871template <typename... ControllerTypes>
872std::tuple<Manager, std::vector<std::shared_ptr<Controller>>> CreateManager(
873 const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
874{
875 constexpr int size = sizeof...(types);
876 constexpr std::array<peak_afl_controllerType, size> controller_types{ types... };
877 std::vector<std::shared_ptr<Controller>> controller{};
878 Manager manager{ node_map };
879 controller.reserve(size);
880
881 std::for_each(controller_types.cbegin(), controller_types.cend(),
882 [&manager, &controller](peak_afl_controllerType type) { controller.emplace_back(manager.CreateController(type)); });
883
884 return { std::move(manager), std::move(controller) };
885}
886
887
895template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
896struct Range
897{
898 T min;
899 T max;
900 T inc;
901};
902
903namespace callback
904{
905using FinishedCallback = std::function<void(void)>;
906using DataProcessingCallback = std::function<void(int, int)>;
907using ProcessingCallback = std::function<void(peak_afl_process_data*)>;
908using ComponentCallback = std::function<void(void)>;
909
910using RegisterFunction = std::function<PEAK_AFL_API_STATUS(void*, void*)>;
911using UnRegisterFunction = std::function<void()>;
912} // namespace callback
913
990class Controller : public std::enable_shared_from_this<Controller>
991{
992 friend class Manager;
993
994 template <class T>
995 class Callback
996 {
997#ifndef SWIG
998 public:
999 template <typename R, typename... Args>
1000 Callback(const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
1001 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback)
1002 : m_unregister_function(std::move(unregister_function))
1003 , m_callback(std::move(callback))
1004 {
1005 const auto ret = register_function(reinterpret_cast<void*>(&Callback::Func<Args...>), this);
1006 if (ret != PEAK_AFL_STATUS_SUCCESS)
1007 {
1008 error::ThrowException(ret);
1009 }
1010 m_controller = controller;
1011 }
1012
1013 virtual ~Callback()
1014 {
1015 if (auto controller = m_controller.lock())
1016 {
1017 m_unregister_function();
1018 }
1019 }
1020
1021 private:
1022 template <typename... Args>
1023 static void Func(Args... args, void* ptr)
1024 {
1025 static_cast<Callback*>(ptr)->m_callback(args...);
1026 };
1027#endif
1028
1029 std::weak_ptr<peak::afl::Controller> m_controller{};
1030 callback::UnRegisterFunction m_unregister_function{};
1031 T m_callback{};
1032 };
1033
1034
1044 inline explicit Controller(peak_afl_controller_handle handle)
1045 : m_handle(handle) {};
1046
1047public:
1051 inline ~Controller();
1052
1053 Controller(const Controller&) = delete;
1054 Controller(Controller&&) = delete;
1055 Controller& operator=(const Controller&) = delete;
1056 Controller& operator=(Controller&&) = delete;
1057
1069 PEAK_AFL_NO_DISCARD inline static std::shared_ptr<Controller> Create(peak_afl_controllerType type);
1070
1080 PEAK_AFL_NO_DISCARD inline bool IsSkipFramesSupported() const;
1081
1093 inline void SetSkipFrames(std::uint32_t count);
1094
1106 PEAK_AFL_NO_DISCARD inline std::uint32_t GetSkipFrames() const;
1107
1117 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetSkipFramesRange() const;
1118
1130 PEAK_AFL_NO_DISCARD inline bool IsROISupported() const;
1131
1143 inline void SetROI(peak_afl_rectangle rect);
1144
1156 PEAK_AFL_NO_DISCARD inline peak_afl_rectangle GetROI() const;
1157
1169 PEAK_AFL_NO_DISCARD inline bool IsROIPresetSupported() const;
1170
1182 inline void SetROIPreset(peak_afl_roi_preset preset);
1183
1195 PEAK_AFL_NO_DISCARD inline bool IsModeSupported() const;
1196
1208 inline void SetMode(peak_afl_controller_automode mode);
1209
1219 PEAK_AFL_NO_DISCARD inline peak_afl_controller_automode GetMode() const;
1220
1232 PEAK_AFL_NO_DISCARD bool IsBrightnessAlgorithmSupported() const;
1233
1247
1256
1268 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status Status() const;
1269
1281 PEAK_AFL_NO_DISCARD inline std::uint8_t GetLastAutoAverage() const;
1282
1294 PEAK_AFL_NO_DISCARD inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> GetLastAutoAverages() const;
1295
1307 PEAK_AFL_NO_DISCARD inline bool IsAutoTargetSupported() const;
1308
1321 inline void SetAutoTarget(uint32_t target);
1322
1332 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTarget() const;
1333
1346 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoTargetRange() const;
1347
1359 PEAK_AFL_NO_DISCARD inline bool IsAutoToleranceSupported() const;
1360
1372 inline void SetAutoTolerance(std::uint32_t tolerance);
1373
1383 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTolerance() const;
1384
1397 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoToleranceRange() const;
1398
1410 PEAK_AFL_NO_DISCARD inline bool IsAutoPercentileSupported() const;
1411
1424 inline void SetAutoPercentile(double percentile);
1425
1435 PEAK_AFL_NO_DISCARD inline double GetAutoPercentile() const;
1436
1449 PEAK_AFL_NO_DISCARD inline Range<double> GetAutoPercentileRange() const;
1450
1462 PEAK_AFL_NO_DISCARD inline peak_afl_controllerType Type() const;
1463
1477 PEAK_AFL_NO_DISCARD inline bool IsAlgorithmSupported() const;
1478
1490 inline void SetAlgorithm(peak_afl_controller_algorithm algorithm);
1491
1499 PEAK_AFL_NO_DISCARD inline peak_afl_controller_algorithm GetAlgorithm() const;
1500
1512 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_algorithm> GetAlgorithmList() const;
1513
1525 PEAK_AFL_NO_DISCARD inline bool IsSharpnessAlgorithmSupported() const;
1526
1539
1549 PEAK_AFL_NO_DISCARD inline peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const;
1550
1562 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_sharpness_algorithm> GetSharpnessAlgorithmList() const;
1563
1573 inline void RegisterFinishedCallback(const callback::FinishedCallback& callback);
1574
1582 inline void UnRegisterFinishedCallback();
1583
1592 inline void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback);
1593
1604
1614 PEAK_AFL_DEPRECATED_ATTR inline void RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback);
1615
1623 PEAK_AFL_DEPRECATED_ATTR inline void UnRegisterDataProcessingCallback();
1624
1632 inline void RegisterProcessingCallback(const callback::ProcessingCallback& callback);
1633
1641 inline void UnRegisterProcessingCallback();
1642
1654 PEAK_AFL_NO_DISCARD inline bool IsWeightedROISupported() const;
1655
1667 inline void SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list);
1668
1680 inline void SetWeightedROI(const peak_afl_weighted_rectangle& rect);
1681
1691 PEAK_AFL_NO_DISCARD inline peak_afl_size GetWeightedROIMinSize() const;
1692
1702 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_weighted_rectangle> GetWeightedROIs() const;
1703
1715 PEAK_AFL_NO_DISCARD inline bool IsLimitSupported() const;
1716
1728 inline void SetLimit(peak_afl_controller_limit limit);
1729
1739 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetLimit() const;
1740
1750 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetDefaultLimit() const;
1751
1763 PEAK_AFL_NO_DISCARD inline bool IsHysteresisSupported() const;
1764
1776 inline void SetHysteresis(std::uint8_t hysteresis);
1777
1787 PEAK_AFL_NO_DISCARD inline std::uint8_t GetHysteresis() const;
1788
1798 PEAK_AFL_NO_DISCARD inline std::uint8_t GetDefaultHysteresis() const;
1799
1809 PEAK_AFL_NO_DISCARD inline Range<std::uint8_t> GetHysteresisRange() const;
1810
1822 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentModeSupported() const;
1823
1836 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentUnitSupported(peak_afl_controller_brightness_component component) const;
1837
1851
1864
1877 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status BrightnessComponentStatus(
1879
1889 PEAK_AFL_NO_DISCARD inline bool IsGainLimitSupported() const;
1890
1907 inline void SetGainLimit(peak_afl_double_limit limit);
1908
1918 inline peak_afl_double_limit GetGainLimit() const;
1919
1930
1946 inline void SetGainAnalogLimit(peak_afl_double_limit limit);
1947
1958
1969
1985 inline void SetGainDigitalLimit(peak_afl_double_limit limit);
1986
1997
2008
2025
2036
2047
2063 inline void SetGainHostLimit(peak_afl_double_limit limit);
2064
2075
2086
2096 inline void SetExposureLimit(peak_afl_double_limit limit);
2097
2108
2119
2120
2121private:
2122 using FinishedCallbackType = Callback<callback::FinishedCallback>;
2123 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
2124 using ProcessingCallbackType = Callback<callback::ProcessingCallback>;
2125 using ComponentCallbackType = Callback<callback::ComponentCallback>;
2126
2127 peak_afl_controller_handle m_handle{};
2128 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
2129 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
2130 std::unique_ptr<ProcessingCallbackType> m_ProcessingCallback{};
2131 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
2132
2133 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
2134
2135 std::unique_ptr<ComponentCallbackType> m_AnalogGainCallback{};
2136 std::unique_ptr<ComponentCallbackType> m_DigitalGainCallback{};
2137 std::unique_ptr<ComponentCallbackType> m_CombinedGainCallback{};
2138 std::unique_ptr<ComponentCallbackType> m_HostGainCallback{};
2139};
2140
2141namespace library
2142{
2143inline void Init()
2144{
2145 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Init();
2146 if (ret != PEAK_AFL_STATUS_SUCCESS)
2147
2148 {
2149 error::ThrowException(ret, false);
2150 }
2151}
2152
2153inline void Exit()
2154{
2155 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Exit();
2156 if (ret != PEAK_AFL_STATUS_SUCCESS)
2157 {
2158 error::ThrowException(ret, false);
2159 }
2160}
2161
2163{
2164 Version_t version{};
2165
2166 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetVersion(&version.major, &version.minor, &version.subminor, &version.patch);
2167 if (ret != PEAK_AFL_STATUS_SUCCESS)
2168 {
2169 error::ThrowException(ret, false);
2170 }
2171
2172 return version;
2173}
2174
2175inline std::string GetLastError()
2176{
2177 std::size_t lastErrorMessageSize;
2178 peak_afl_status code;
2179
2180 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, nullptr, &lastErrorMessageSize);
2181 if (ret != PEAK_AFL_STATUS_SUCCESS)
2182 {
2183 return "Cannot get last error!";
2184 }
2185
2186 std::vector<char> text;
2187 text.resize(lastErrorMessageSize);
2188
2189 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, text.data(), &lastErrorMessageSize);
2190 if (ret != PEAK_AFL_STATUS_SUCCESS)
2191 {
2192 return "Cannot get last error!";
2193 }
2194
2195 return { text.begin(), text.end() };
2196}
2197} // namespace library
2198
2199inline Manager::Manager(const std::shared_ptr<peak::core::NodeMap>& node_map)
2200{
2201 if (node_map == nullptr)
2202 {
2204 }
2205
2206 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Create(&m_handle, node_map->Handle());
2207 if (ret != PEAK_AFL_STATUS_SUCCESS)
2208 {
2209 error::ThrowException(ret);
2210 }
2211}
2212
2214{
2215 if (m_handle != nullptr)
2216 {
2217 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
2218
2219 {
2220 std::lock_guard<std::mutex> lck(m_mutex);
2221 for (auto& c : m_controllerList)
2222 {
2223 c->m_handle = nullptr;
2224 }
2225 }
2226
2227 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Destroy(m_handle);
2228 m_handle = nullptr;
2229 }
2230}
2231
2232inline Manager::Manager(Manager&& other) noexcept
2233{
2234 m_handle = other.m_handle;
2235 other.m_handle = nullptr;
2236
2237 std::lock_guard<std::mutex> lck(other.m_mutex);
2238 m_controllerList = std::move(other.m_controllerList);
2239}
2240
2241inline Manager& Manager::operator=(Manager&& other) noexcept
2242{
2243 m_handle = other.m_handle;
2244 other.m_handle = nullptr;
2245
2246 std::lock_guard<std::mutex> lck(other.m_mutex);
2247 m_controllerList = std::move(other.m_controllerList);
2248
2249 return *this;
2250}
2251
2252inline void Manager::AddController(const std::shared_ptr<Controller>& controller)
2253{
2254 std::lock_guard<std::mutex> lck(m_mutex);
2255
2256 auto cnt = std::any_of(
2257 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2258
2259 if (cnt)
2260 {
2261 return;
2262 }
2263
2264 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_AddController(m_handle, controller->m_handle);
2265 if (ret != PEAK_AFL_STATUS_SUCCESS)
2266 {
2267 error::ThrowException(ret);
2268 }
2269
2270 m_controllerList.emplace_back(controller);
2271}
2272
2273inline void Manager::RemoveController(const std::shared_ptr<Controller>& controller)
2274{
2275 std::lock_guard<std::mutex> lck(m_mutex);
2276
2277 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_RemoveController(m_handle, controller->m_handle);
2278 if (ret != PEAK_AFL_STATUS_SUCCESS)
2279 {
2280 error::ThrowException(ret);
2281 }
2282
2283 auto it = std::remove_if(
2284 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2285
2286 m_controllerList.erase(it, m_controllerList.end());
2287}
2288
2289inline void Manager::Process(const peak::ipl::Image& image) const
2290{
2291 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Process(m_handle, ImageBackendAccessor::BackendHandle(image));
2292 if (ret != PEAK_AFL_STATUS_SUCCESS)
2293 {
2294 error::ThrowException(ret);
2295 }
2296}
2297
2298inline std::shared_ptr<Controller> Manager::CreateController(peak_afl_controllerType type)
2299{
2300 std::lock_guard<std::mutex> lck(m_mutex);
2301
2303 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_CreateController(m_handle, &handle, type);
2304 if (ret != PEAK_AFL_STATUS_SUCCESS)
2305 {
2306 error::ThrowException(ret);
2307 }
2308
2309 auto shared = std::shared_ptr<Controller>(new Controller(handle));
2310 m_controllerList.emplace_back(shared);
2311
2312 return shared;
2313}
2314
2316{
2317 std::lock_guard<std::mutex> lck(m_mutex);
2318
2319 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
2320 if (ret != PEAK_AFL_STATUS_SUCCESS)
2321 {
2322 error::ThrowException(ret);
2323 }
2324
2325 for (auto& c : m_controllerList)
2326 {
2327 c->m_handle = nullptr;
2328 }
2329
2330 m_controllerList.clear();
2331}
2332
2333inline void Manager::DestroyController(const std::shared_ptr<Controller>& controller)
2334{
2335 std::lock_guard<std::mutex> lck(m_mutex);
2336
2337 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyController(m_handle, controller->m_handle);
2338 if (ret != PEAK_AFL_STATUS_SUCCESS)
2339 {
2340 error::ThrowException(ret);
2341 }
2342
2343 auto it = std::remove_if(
2344 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2345
2346 m_controllerList.erase(it, m_controllerList.end());
2347
2348 controller->m_handle = nullptr;
2349}
2350
2351inline void Manager::SetGainIPL(const peak::ipl::Gain& gain)
2352{
2353 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetGainIPL(m_handle, GainBackendAccessor::BackendHandle(gain));
2354 if (ret != PEAK_AFL_STATUS_SUCCESS)
2355 {
2356 error::ThrowException(ret);
2357 }
2358}
2359
2360inline void Manager::SetCCM(std::array<float, 9> ccm)
2361{
2362 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetCCM(m_handle, ccm.data(), ccm.size());
2363 if (ret != PEAK_AFL_STATUS_SUCCESS)
2364 {
2365 error::ThrowException(ret);
2366 }
2367}
2368
2369inline bool Manager::Status() const
2370{
2371 std::uint8_t status;
2372 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Status(m_handle, &status);
2373 if (ret != PEAK_AFL_STATUS_SUCCESS)
2374 {
2375 error::ThrowException(ret);
2376 }
2377
2378 return status;
2379}
2380
2381inline std::vector<std::shared_ptr<Controller>> Manager::ControllerList() const
2382{
2383 std::lock_guard<std::mutex> lck(m_mutex);
2384
2385 std::vector<std::shared_ptr<Controller>> controller{};
2386
2387 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
2388
2389 return controller;
2390}
2391
2392inline size_t Manager::ControllerCount() const
2393{
2394 return m_controllerList.size();
2395}
2396
2397inline std::shared_ptr<Controller> Manager::GetController(peak_afl_controllerType type) const
2398{
2399 std::lock_guard<std::mutex> lck(m_mutex);
2400
2401 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(),
2402 [=](const std::shared_ptr<Controller>& controller) { return type == controller->Type(); });
2403
2404 if (it != m_controllerList.cend())
2405 {
2406 return *it;
2407 }
2408 else
2409 {
2410 throw error::InternalErrorException("No controller found!", PEAK_AFL_STATUS_ERROR);
2411 }
2412}
2413
2415{
2416 peak_afl_BOOL8 supported{};
2417 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Controller_IsSupported(m_handle, type, &supported);
2418 if (ret != PEAK_AFL_STATUS_SUCCESS)
2419 {
2420 error::ThrowException(ret);
2421 }
2422
2423 return supported != PEAK_AFL_FALSE;
2424}
2425
2426
2427inline std::shared_ptr<Controller> Controller::Create(peak_afl_controllerType type)
2428{
2430 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Create(&handle, type);
2431 if (ret != PEAK_AFL_STATUS_SUCCESS)
2432 {
2433 error::ThrowException(ret);
2434 }
2435
2436 return std::shared_ptr<Controller>(new Controller(handle));
2437}
2438
2440{
2441 if (m_handle != nullptr)
2442 {
2443 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Destroy(m_handle);
2444 m_handle = nullptr;
2445 }
2446}
2447
2449{
2450 peak_afl_BOOL8 supported{};
2451 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_IsSupported(m_handle, &supported);
2452 if (ret != PEAK_AFL_STATUS_SUCCESS)
2453 {
2454 error::ThrowException(ret);
2455 }
2456
2457 return supported;
2458}
2459
2460inline void Controller::SetSkipFrames(std::uint32_t count)
2461{
2462 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Set(m_handle, count);
2463 if (ret != PEAK_AFL_STATUS_SUCCESS)
2464 {
2465 error::ThrowException(ret);
2466 }
2467}
2468
2469inline std::uint32_t Controller::GetSkipFrames() const
2470{
2471 std::uint32_t count{};
2472 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Get(m_handle, &count);
2473 if (ret != PEAK_AFL_STATUS_SUCCESS)
2474 {
2475 error::ThrowException(ret);
2476 }
2477
2478 return count;
2479}
2480
2482{
2483 Range<std::uint32_t> range{};
2484 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_GetRange(m_handle, &range.min, &range.max, &range.inc);
2485 if (ret != PEAK_AFL_STATUS_SUCCESS)
2486 {
2487 error::ThrowException(ret);
2488 }
2489
2490 return range;
2491}
2492
2494{
2495 peak_afl_BOOL8 supported{};
2496 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_IsSupported(m_handle, &supported);
2497 if (ret != PEAK_AFL_STATUS_SUCCESS)
2498 {
2499 error::ThrowException(ret);
2500 }
2501
2502 return supported;
2503}
2504
2506{
2507 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Set(m_handle, rect);
2508 if (ret != PEAK_AFL_STATUS_SUCCESS)
2509 {
2510 error::ThrowException(ret);
2511 }
2512}
2513
2515{
2516 peak_afl_rectangle rect{};
2517 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Get(m_handle, &rect);
2518 if (ret != PEAK_AFL_STATUS_SUCCESS)
2519 {
2520 error::ThrowException(ret);
2521 }
2522 return rect;
2523}
2524
2526{
2527 peak_afl_BOOL8 supported{};
2528 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_IsSupported(m_handle, &supported);
2529 if (ret != PEAK_AFL_STATUS_SUCCESS)
2530 {
2531 error::ThrowException(ret);
2532 }
2533
2534 return supported;
2535}
2536
2538{
2539 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_Set(m_handle, preset);
2540 if (ret != PEAK_AFL_STATUS_SUCCESS)
2541 {
2542 error::ThrowException(ret);
2543 }
2544}
2545
2547{
2548 peak_afl_BOOL8 supported{};
2549 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_IsSupported(m_handle, &supported);
2550 if (ret != PEAK_AFL_STATUS_SUCCESS)
2551 {
2552 error::ThrowException(ret);
2553 }
2554
2555 return supported;
2556}
2557
2559{
2560 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Set(m_handle, mode);
2561 if (ret != PEAK_AFL_STATUS_SUCCESS)
2562 {
2563 error::ThrowException(ret);
2564 }
2565}
2566
2568{
2570 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Get(m_handle, &mode);
2571 if (ret != PEAK_AFL_STATUS_SUCCESS)
2572 {
2573 error::ThrowException(ret);
2574 }
2575 return mode;
2576}
2577
2579{
2580 peak_afl_BOOL8 supported{};
2581 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_IsSupported(m_handle, &supported);
2582 if (ret != PEAK_AFL_STATUS_SUCCESS)
2583 {
2584 error::ThrowException(ret);
2585 }
2586
2587 return supported;
2588}
2589
2591{
2592 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Set(m_handle, algorithm);
2593 if (ret != PEAK_AFL_STATUS_SUCCESS)
2594 {
2595 error::ThrowException(ret);
2596 }
2597}
2598
2600{
2602 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Get(m_handle, &algorithm);
2603 if (ret != PEAK_AFL_STATUS_SUCCESS)
2604 {
2605 error::ThrowException(ret);
2606 }
2607 return algorithm;
2608}
2609
2611{
2613 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Status(m_handle, &status);
2614 if (ret != PEAK_AFL_STATUS_SUCCESS)
2615 {
2616 error::ThrowException(ret);
2617 }
2618 return status;
2619}
2620
2621
2622inline std::uint8_t Controller::GetLastAutoAverage() const
2623{
2624 std::uint8_t average{};
2625 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverage(m_handle, &average);
2626 if (ret != PEAK_AFL_STATUS_SUCCESS)
2627 {
2628 error::ThrowException(ret);
2629 }
2630 return average;
2631}
2632
2633inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> Controller::GetLastAutoAverages() const
2634{
2635 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
2636 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverages(m_handle, &averageRed, &averageGreen, &averageBlue);
2637 if (ret != PEAK_AFL_STATUS_SUCCESS)
2638 {
2639 error::ThrowException(ret);
2640 }
2641 return { averageRed, averageGreen, averageBlue };
2642}
2643
2645{
2646 peak_afl_BOOL8 supported{};
2647 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_IsSupported(m_handle, &supported);
2648 if (ret != PEAK_AFL_STATUS_SUCCESS)
2649 {
2650 error::ThrowException(ret);
2651 }
2652
2653 return supported;
2654}
2655
2656inline void Controller::SetAutoTarget(std::uint32_t target)
2657{
2658 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Set(m_handle, target);
2659 if (ret != PEAK_AFL_STATUS_SUCCESS)
2660 {
2661 error::ThrowException(ret);
2662 }
2663}
2664
2665inline std::uint32_t Controller::GetAutoTarget() const
2666{
2667 std::uint32_t target{};
2668 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Get(m_handle, &target);
2669 if (ret != PEAK_AFL_STATUS_SUCCESS)
2670 {
2671 error::ThrowException(ret);
2672 }
2673 return target;
2674}
2675
2677{
2678 Range<std::uint32_t> range{};
2679 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_GetRange(m_handle, &range.min, &range.max, &range.inc);
2680 if (ret != PEAK_AFL_STATUS_SUCCESS)
2681 {
2682 error::ThrowException(ret);
2683 }
2684 return range;
2685}
2686
2688{
2689 peak_afl_BOOL8 supported{};
2690 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_IsSupported(m_handle, &supported);
2691 if (ret != PEAK_AFL_STATUS_SUCCESS)
2692 {
2693 error::ThrowException(ret);
2694 }
2695
2696 return supported;
2697}
2698
2699inline void Controller::SetAutoTolerance(uint32_t tolerance)
2700{
2701 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Set(m_handle, tolerance);
2702 if (ret != PEAK_AFL_STATUS_SUCCESS)
2703 {
2704 error::ThrowException(ret);
2705 }
2706}
2707
2708inline uint32_t Controller::GetAutoTolerance() const
2709{
2710 std::uint32_t tolerance;
2711 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Get(m_handle, &tolerance);
2712 if (ret != PEAK_AFL_STATUS_SUCCESS)
2713 {
2714 error::ThrowException(ret);
2715 }
2716 return tolerance;
2717}
2718
2720{
2721 Range<uint32_t> range{};
2722 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_GetRange(m_handle, &range.min, &range.max, &range.inc);
2723 if (ret != PEAK_AFL_STATUS_SUCCESS)
2724 {
2725 error::ThrowException(ret);
2726 }
2727 return range;
2728}
2729
2731{
2732 peak_afl_BOOL8 supported{};
2733 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_IsSupported(m_handle, &supported);
2734 if (ret != PEAK_AFL_STATUS_SUCCESS)
2735 {
2736 error::ThrowException(ret);
2737 }
2738
2739 return supported;
2740}
2741
2742inline void Controller::SetAutoPercentile(double percentile)
2743{
2744 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Set(m_handle, percentile);
2745 if (ret != PEAK_AFL_STATUS_SUCCESS)
2746 {
2747 error::ThrowException(ret);
2748 }
2749}
2750
2752{
2753 double percentile;
2754 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Get(m_handle, &percentile);
2755 if (ret != PEAK_AFL_STATUS_SUCCESS)
2756 {
2757 error::ThrowException(ret);
2758 }
2759 return percentile;
2760}
2761
2763{
2764 Range<double> range{};
2765 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_GetRange(m_handle, &range.min, &range.max, &range.inc);
2766 if (ret != PEAK_AFL_STATUS_SUCCESS)
2767 {
2768 error::ThrowException(ret);
2769 }
2770 return range;
2771}
2772
2774{
2776 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Type_Get(m_handle, &type);
2777 if (ret != PEAK_AFL_STATUS_SUCCESS)
2778 {
2779 error::ThrowException(ret);
2780 }
2781 return type;
2782}
2783
2785{
2786 peak_afl_BOOL8 supported{};
2787 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_IsSupported(m_handle, &supported);
2788 if (ret != PEAK_AFL_STATUS_SUCCESS)
2789 {
2790 error::ThrowException(ret);
2791 }
2792
2793 return supported;
2794}
2795
2797{
2798 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Set(m_handle, alg);
2799 if (ret != PEAK_AFL_STATUS_SUCCESS)
2800 {
2801 error::ThrowException(ret);
2802 }
2803}
2804
2806{
2808 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Get(m_handle, &alg);
2809 if (ret != PEAK_AFL_STATUS_SUCCESS)
2810 {
2811 error::ThrowException(ret);
2812 }
2813
2814 return alg;
2815}
2816
2817inline std::vector<peak_afl_controller_algorithm> Controller::GetAlgorithmList() const
2818{
2819 std::vector<peak_afl_controller_algorithm> algList{};
2820 std::uint32_t listSize{};
2821
2822 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, nullptr, &listSize);
2823 if (ret != PEAK_AFL_STATUS_SUCCESS)
2824 {
2825 error::ThrowException(ret);
2826 }
2827
2828 algList.resize(listSize);
2829
2830 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, algList.data(), &listSize);
2831 if (ret != PEAK_AFL_STATUS_SUCCESS)
2832 {
2833 error::ThrowException(ret);
2834 }
2835
2836 return algList;
2837}
2838
2840{
2841 peak_afl_BOOL8 supported{};
2842 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_IsSupported(m_handle, &supported);
2843 if (ret != PEAK_AFL_STATUS_SUCCESS)
2844 {
2845 error::ThrowException(ret);
2846 }
2847
2848 return supported;
2849}
2850
2852{
2853 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Set(m_handle, alg);
2854 if (ret != PEAK_AFL_STATUS_SUCCESS)
2855 {
2856 error::ThrowException(ret);
2857 }
2858}
2859
2861{
2863 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Get(m_handle, &alg);
2864 if (ret != PEAK_AFL_STATUS_SUCCESS)
2865 {
2866 error::ThrowException(ret);
2867 }
2868
2869 return alg;
2870}
2871
2872inline std::vector<peak_afl_controller_sharpness_algorithm> Controller::GetSharpnessAlgorithmList() const
2873{
2874 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
2875 std::uint32_t listSize{};
2876
2877 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, nullptr, &listSize);
2878 if (ret != PEAK_AFL_STATUS_SUCCESS)
2879 {
2880 error::ThrowException(ret);
2881 }
2882
2883 algList.resize(listSize);
2884
2885 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, algList.data(), &listSize);
2886 if (ret != PEAK_AFL_STATUS_SUCCESS)
2887 {
2888 error::ThrowException(ret);
2889 }
2890
2891 return algList;
2892}
2893
2894inline void Controller::RegisterFinishedCallback(const callback::FinishedCallback& callback)
2895{
2896 m_finishedCallback = std::make_unique<FinishedCallbackType>(
2897 shared_from_this(),
2898 [handle = m_handle](void* ptr, void* ctx) {
2899 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx);
2900 },
2901 [handle = m_handle] {
2902 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
2903 handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr);
2904 },
2905 callback);
2906}
2907
2909{
2910 m_finishedCallback.reset();
2911}
2912
2914 peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback)
2915{
2917 {
2918 throw error::NotSupportedException("Brightness component not supported!", PEAK_AFL_STATUS_NOT_SUPPORTED);
2919 }
2920
2921 const auto registerCallback = [&](peak_afl_controller_brightness_component component) {
2922 return std::make_unique<ComponentCallbackType>(
2923 shared_from_this(),
2924 [handle = m_handle, component](void* ptr, void* ctx) {
2926 handle, component, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx);
2927 },
2928 [handle = m_handle, component] {
2930 handle, component, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr);
2931 },
2932 callback);
2933 };
2934
2935 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
2937 {
2938 m_finishedExposureCallback = registerCallback(component);
2939 }
2941 {
2942 m_finishedGainCallback = registerCallback(component);
2943 }
2945 {
2946 m_AnalogGainCallback = registerCallback(component);
2947 }
2949 {
2950 m_DigitalGainCallback = registerCallback(component);
2951 }
2953 {
2954 m_CombinedGainCallback = registerCallback(component);
2955 }
2957 {
2958 m_HostGainCallback = registerCallback(component);
2959 }
2960 else
2961 {
2962 throw error::InvalidParameterException("Brightness component type is invalid!", PEAK_AFL_STATUS_INVALID_PARAMETER);
2963 }
2964 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
2965}
2966
2968{
2969 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
2971 {
2972 m_finishedExposureCallback.reset();
2973 }
2975 {
2976 m_finishedGainCallback.reset();
2977 }
2979 {
2980 m_AnalogGainCallback.reset();
2981 }
2983 {
2984 m_DigitalGainCallback.reset();
2985 }
2987 {
2988 m_CombinedGainCallback.reset();
2989 }
2991 {
2992 m_HostGainCallback.reset();
2993 }
2994 else
2995 {
2996 throw error::InvalidParameterException("Brightness component type is invalid!", PEAK_AFL_STATUS_INVALID_PARAMETER);
2997 }
2998 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
2999}
3000
3001inline void Controller::RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback)
3002{
3003 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
3004 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(
3005 shared_from_this(),
3006 [handle = m_handle](void* ptr, void* ctx) {
3007 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3009 },
3010 [handle = m_handle] {
3011 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3012 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, nullptr, nullptr);
3013 },
3014 callback);
3015 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
3016}
3017
3018inline void Controller::RegisterProcessingCallback(const callback::ProcessingCallback& callback)
3019{
3020 m_ProcessingCallback = std::make_unique<ProcessingCallbackType>(
3021 shared_from_this(),
3022 [handle = m_handle](void* ptr, void* ctx) {
3023 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3024 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING, ptr, ctx);
3025 },
3026 [handle = m_handle] {
3027 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3028 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING, nullptr, nullptr);
3029 },
3030 callback);
3031}
3032
3034{
3035 m_ProcessingCallback.reset();
3036}
3037
3039{
3040 m_dataProcessingCallback.reset();
3041}
3042
3044{
3045 peak_afl_BOOL8 supported{};
3046 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_IsSupported(m_handle, &supported);
3047 if (ret != PEAK_AFL_STATUS_SUCCESS)
3048 {
3049 error::ThrowException(ret);
3050 }
3051
3052 return supported;
3053}
3054
3055inline void Controller::SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list)
3056{
3057 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(
3058 m_handle, list.data(), static_cast<uint32_t>(list.size()));
3059 if (ret != PEAK_AFL_STATUS_SUCCESS)
3060 {
3061 error::ThrowException(ret);
3062 }
3063}
3064
3066{
3067 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, &rect, 1);
3068 if (ret != PEAK_AFL_STATUS_SUCCESS)
3069 {
3070 error::ThrowException(ret);
3071 }
3072}
3073
3075{
3076 peak_afl_size minSize{};
3077 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Min_Size(m_handle, &minSize);
3078 if (ret != PEAK_AFL_STATUS_SUCCESS)
3079 {
3080 error::ThrowException(ret);
3081 }
3082 return minSize;
3083}
3084
3085inline std::vector<peak_afl_weighted_rectangle> Controller::GetWeightedROIs() const
3086{
3087 std::vector<peak_afl_weighted_rectangle> list;
3088 std::uint32_t listSize{};
3089
3090 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, nullptr, &listSize);
3091 if (ret != PEAK_AFL_STATUS_SUCCESS)
3092 {
3093 error::ThrowException(ret);
3094 }
3095
3096 list.resize(listSize);
3097
3098 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, list.data(), &listSize);
3099 if (ret != PEAK_AFL_STATUS_SUCCESS)
3100 {
3101 error::ThrowException(ret);
3102 }
3103
3104 return list;
3105}
3106
3108{
3109 peak_afl_BOOL8 supported{};
3110 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_IsSupported(m_handle, &supported);
3111 if (ret != PEAK_AFL_STATUS_SUCCESS)
3112 {
3113 error::ThrowException(ret);
3114 }
3115
3116 return supported;
3117}
3118
3120{
3121 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Set(m_handle, limit);
3122 if (ret != PEAK_AFL_STATUS_SUCCESS)
3123 {
3124 error::ThrowException(ret);
3125 }
3126}
3127
3129{
3131 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Get(m_handle, &limit);
3132 if (ret != PEAK_AFL_STATUS_SUCCESS)
3133 {
3134 error::ThrowException(ret);
3135 }
3136 return limit;
3137}
3138
3140{
3142 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Default(m_handle, &limit);
3143 if (ret != PEAK_AFL_STATUS_SUCCESS)
3144 {
3145 error::ThrowException(ret);
3146 }
3147 return limit;
3148}
3149
3151{
3152 peak_afl_BOOL8 supported{};
3153 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_IsSupported(m_handle, &supported);
3154 if (ret != PEAK_AFL_STATUS_SUCCESS)
3155 {
3156 error::ThrowException(ret);
3157 }
3158
3159 return supported;
3160}
3161
3162inline void Controller::SetHysteresis(std::uint8_t hysteresis)
3163{
3164 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Set(m_handle, hysteresis);
3165 if (ret != PEAK_AFL_STATUS_SUCCESS)
3166 {
3167 error::ThrowException(ret);
3168 }
3169}
3170
3171inline std::uint8_t Controller::GetHysteresis() const
3172{
3173 std::uint8_t hysteresis{};
3174 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Get(m_handle, &hysteresis);
3175 if (ret != PEAK_AFL_STATUS_SUCCESS)
3176 {
3177 error::ThrowException(ret);
3178 }
3179
3180 return hysteresis;
3181}
3182
3183inline std::uint8_t Controller::GetDefaultHysteresis() const
3184{
3185 std::uint8_t hysteresis{};
3186 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Default(m_handle, &hysteresis);
3187 if (ret != PEAK_AFL_STATUS_SUCCESS)
3188 {
3189 error::ThrowException(ret);
3190 }
3191
3192 return hysteresis;
3193}
3194
3196{
3197 Range<std::uint8_t> hysteresis{};
3198 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_GetRange(
3199 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
3200 if (ret != PEAK_AFL_STATUS_SUCCESS)
3201 {
3202 error::ThrowException(ret);
3203 }
3204
3205 return hysteresis;
3206}
3207
3208PEAK_AFL_NO_DISCARD inline bool Controller::IsBrightnessComponentModeSupported() const
3209{
3210 peak_afl_BOOL8 supported{};
3211 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(m_handle, &supported);
3212 if (ret != PEAK_AFL_STATUS_SUCCESS)
3213 {
3214 error::ThrowException(ret);
3215 }
3216
3217 return supported;
3218}
3219
3222{
3223 peak_afl_BOOL8 supported{};
3224 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Unit_IsSupported(m_handle, component, &supported);
3225 if (ret != PEAK_AFL_STATUS_SUCCESS)
3226 {
3227 error::ThrowException(ret);
3228 }
3229
3230 return supported;
3231}
3232
3235{
3236 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Set(m_handle, component, mode);
3237 if (ret != PEAK_AFL_STATUS_SUCCESS)
3238 {
3239 error::ThrowException(ret);
3240 }
3241}
3242
3245{
3247 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Get(m_handle, component, &mode);
3248 if (ret != PEAK_AFL_STATUS_SUCCESS)
3249 {
3250 error::ThrowException(ret);
3251 }
3252 return mode;
3253}
3254
3257{
3259 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Status(m_handle, component, &status);
3260 if (ret != PEAK_AFL_STATUS_SUCCESS)
3261 {
3262 error::ThrowException(ret);
3263 }
3264 return status;
3265}
3266
3268{
3269 peak_afl_BOOL8 supported{};
3270 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_IsSupported(m_handle, &supported);
3271 if (ret != PEAK_AFL_STATUS_SUCCESS)
3272 {
3273 error::ThrowException(ret);
3274 }
3275
3276 return supported;
3277}
3278
3280{
3281 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Set(m_handle, limit);
3283 {
3284 // Do nothing. Not an error.
3285 }
3286 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3287 {
3288 error::ThrowException(ret);
3289 }
3290}
3291
3293{
3294 peak_afl_double_limit limit{};
3295 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Get(m_handle, &limit);
3296 if (ret != PEAK_AFL_STATUS_SUCCESS)
3297 {
3298 error::ThrowException(ret);
3299 }
3300
3301 return limit;
3302}
3303
3305{
3306 peak_afl_double_limit limit{};
3307 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_GetRange(m_handle, &limit);
3308 if (ret != PEAK_AFL_STATUS_SUCCESS)
3309 {
3310 error::ThrowException(ret);
3311 }
3312
3313 return limit;
3314}
3315
3317{
3318 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Set(m_handle, limit);
3320 {
3321 // Do nothing. Not an error.
3322 }
3323 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3324 {
3325 error::ThrowException(ret);
3326 }
3327}
3328
3330{
3331 peak_afl_double_limit limit{};
3332 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Get(m_handle, &limit);
3333 if (ret != PEAK_AFL_STATUS_SUCCESS)
3334 {
3335 error::ThrowException(ret);
3336 }
3337
3338 return limit;
3339}
3340
3342{
3343 peak_afl_double_limit limit{};
3344 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_GetRange(m_handle, &limit);
3345 if (ret != PEAK_AFL_STATUS_SUCCESS)
3346 {
3347 error::ThrowException(ret);
3348 }
3349
3350 return limit;
3351}
3352
3354{
3355 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Set(m_handle, limit);
3357 {
3358 // Do nothing. Not an error.
3359 }
3360 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3361 {
3362 error::ThrowException(ret);
3363 }
3364}
3365
3367{
3368 peak_afl_double_limit limit{};
3369 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Get(m_handle, &limit);
3370 if (ret != PEAK_AFL_STATUS_SUCCESS)
3371 {
3372 error::ThrowException(ret);
3373 }
3374
3375 return limit;
3376}
3377
3379{
3380 peak_afl_double_limit limit{};
3381 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_GetRange(m_handle, &limit);
3382 if (ret != PEAK_AFL_STATUS_SUCCESS)
3383 {
3384 error::ThrowException(ret);
3385 }
3386
3387 return limit;
3388}
3389
3391{
3392 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Set(m_handle, limit);
3394 {
3395 // Do nothing. Not an error.
3396 }
3397 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3398 {
3399 error::ThrowException(ret);
3400 }
3401}
3402
3404{
3405 peak_afl_double_limit limit{};
3406 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Get(m_handle, &limit);
3407 if (ret != PEAK_AFL_STATUS_SUCCESS)
3408 {
3409 error::ThrowException(ret);
3410 }
3411
3412 return limit;
3413}
3414
3416{
3417 peak_afl_double_limit limit{};
3418 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_GetRange(m_handle, &limit);
3419 if (ret != PEAK_AFL_STATUS_SUCCESS)
3420 {
3421 error::ThrowException(ret);
3422 }
3423
3424 return limit;
3425}
3426
3428{
3429 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Set(m_handle, limit);
3431 {
3432 // Do nothing. Not an error.
3433 }
3434 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3435 {
3436 error::ThrowException(ret);
3437 }
3438}
3439
3441{
3442 peak_afl_double_limit limit{};
3443 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Get(m_handle, &limit);
3444 if (ret != PEAK_AFL_STATUS_SUCCESS)
3445 {
3446 error::ThrowException(ret);
3447 }
3448
3449 return limit;
3450}
3451
3453{
3454 peak_afl_double_limit limit{};
3455 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_GetRange(m_handle, &limit);
3456 if (ret != PEAK_AFL_STATUS_SUCCESS)
3457 {
3458 error::ThrowException(ret);
3459 }
3460
3461 return limit;
3462}
3463
3465{
3466 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Set(m_handle, limit);
3467 if (ret != PEAK_AFL_STATUS_SUCCESS)
3468 {
3469 error::ThrowException(ret);
3470 }
3471}
3472
3474{
3475 peak_afl_double_limit limit{};
3476 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Get(m_handle, &limit);
3477 if (ret != PEAK_AFL_STATUS_SUCCESS)
3478 {
3479 error::ThrowException(ret);
3480 }
3481
3482 return limit;
3483}
3484
3486{
3487 peak_afl_double_limit limit{};
3488 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_GetRange(m_handle, &limit);
3489 if (ret != PEAK_AFL_STATUS_SUCCESS)
3490 {
3491 error::ThrowException(ret);
3492 }
3493
3494 return limit;
3495}
3496
3497} /* namespace afl */
3498} /* namespace peak */
High-level interface for automatic camera feature control, providing access to algorithms such as aut...
Definition peak_afl.hpp:991
peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:2773
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:2537
void SetBrightnessAlgorithm(peak_afl_controller_brightness_algorithm algorithm)
Set the autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:2590
bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:2730
bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:2687
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:3292
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:3279
std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:3183
std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:3171
void SetGainCombinedLimit(peak_afl_double_limit limit)
Set the combined gain limit for a controller.
Definition peak_afl.hpp:3390
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:2558
bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:2493
void SetGainHostLimit(peak_afl_double_limit limit)
Set the host gain limit for a controller.
Definition peak_afl.hpp:3427
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3055
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2908
peak_afl_double_limit GetGainDigitalLimit() const
Get autofeature digital gain limit for a controller.
Definition peak_afl.hpp:3366
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:3243
Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:2481
bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:2525
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:3233
std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:2622
peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:3128
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:3162
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:3464
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:2460
std::vector< peak_afl_controller_sharpness_algorithm > GetSharpnessAlgorithmList() const
Get the list of supported sharpness algorithms for a controller.
Definition peak_afl.hpp:2872
bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:2546
Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:2719
void SetGainAnalogLimit(peak_afl_double_limit limit)
Set the analog gain limit for a controller.
Definition peak_afl.hpp:3316
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:2742
void UnRegisterProcessingCallback()
Reset the data callback for a controller.
Definition peak_afl.hpp:3033
peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:2514
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:3473
void UnRegisterDataProcessingCallback()
Reset the data callback for a controller.
Definition peak_afl.hpp:3038
peak_afl_double_limit GetGainCombinedLimitRange() const
Get autofeature combined gain limit range for a controller.
Definition peak_afl.hpp:3415
std::vector< peak_afl_controller_algorithm > GetAlgorithmList() const
Get the list of supported algorithms for a controller.
Definition peak_afl.hpp:2817
~Controller()
Definition peak_afl.hpp:2439
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:3001
bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:2839
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:2967
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:2633
std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:2708
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:2796
peak_afl_double_limit GetGainDigitalLimitRange() const
Get autofeature digital gain limit range for a controller.
Definition peak_afl.hpp:3378
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:2505
peak_afl_double_limit GetGainAnalogLimitRange() const
Get autofeature analog gain limit range for a controller.
Definition peak_afl.hpp:3341
bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:2448
peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:3139
bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:3107
peak_afl_size GetWeightedROIMinSize() const
Get the autofeature minimum size of weighted region of interest for a controller.
Definition peak_afl.hpp:3074
peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:2567
static std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:2427
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:2894
peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:2805
bool IsBrightnessAlgorithmSupported() const
Check if auto brightness algorithm is supported for a controller.
Definition peak_afl.hpp:2578
peak_afl_double_limit GetGainCombinedLimit() const
Get autofeature combined gain limit for a controller.
Definition peak_afl.hpp:3403
bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:3267
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:3304
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3065
std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:2469
peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2860
peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:2610
void SetGainDigitalLimit(peak_afl_double_limit limit)
Set the digital gain limit for a controller.
Definition peak_afl.hpp:3353
bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:2784
Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:2762
peak_afl_double_limit GetExposureLimitRange() const
Get autofeature exposure limit range for a controller.
Definition peak_afl.hpp:3485
double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:2751
peak_afl_controller_brightness_algorithm GetBrightnessAlgorithm() const
Get the current autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:2599
peak_afl_double_limit GetGainAnalogLimit() const
Get autofeature analog gain limit for a controller.
Definition peak_afl.hpp:3329
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:2656
peak_afl_double_limit GetGainHostLimit() const
Get autofeature host gain limit for a controller.
Definition peak_afl.hpp:3440
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:2699
std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:2665
Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:2676
Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:3195
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:3119
bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:3043
bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:3150
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:2913
bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:3208
peak_afl_controller_status BrightnessComponentStatus(peak_afl_controller_brightness_component component) const
Get the status for a brightness controller component.
Definition peak_afl.hpp:3255
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2851
void RegisterProcessingCallback(const callback::ProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:3018
peak_afl_double_limit GetGainHostLimitRange() const
Get autofeature host gain limit range for a controller.
Definition peak_afl.hpp:3452
bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:2644
std::vector< peak_afl_weighted_rectangle > GetWeightedROIs() const
Get the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3085
bool IsBrightnessComponentUnitSupported(peak_afl_controller_brightness_component component) const
Check if a specific unit is supported for a brightness controller component.
Definition peak_afl.hpp:3220
Central coordination object for automatic camera feature control.
Definition peak_afl.hpp:663
bool IsControllerSupported(peak_afl_controllerType type) const
Get if the given controller type is supported.
Definition peak_afl.hpp:2414
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:2199
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:2273
std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:2397
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:2315
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:2333
std::shared_ptr< Controller > CreateController(peak_afl_controllerType type)
Create a controller and append it to Manager.
Definition peak_afl.hpp:2298
void SetCCM(std::array< float, 9 > ccm)
Set the Color Correction Matrix (CCM)
Definition peak_afl.hpp:2360
size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:2392
bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:2369
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:2213
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:2351
std::vector< std::shared_ptr< Controller > > ControllerList() const
Get the list of the controller associated with the manager.
Definition peak_afl.hpp:2381
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:2252
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:2289
The exception thrown for signaling an access error.
Definition peak_afl.hpp:482
The exception thrown when the supplied buffer is too small.
Definition peak_afl.hpp:502
The exception thrown for signaling a busy operation.
Definition peak_afl.hpp:438
static std::string translateCode(peak_afl_status status)
Get a string representation for an error code.
Definition peak_afl.hpp:289
peak_afl_status code() const
Get the return code for the failure.
Definition peak_afl.hpp:275
The exception thrown for signaling an unspecified error.
Definition peak_afl.hpp:340
The exception thrown for signaling an invalid image format.
Definition peak_afl.hpp:461
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:391
The exception thrown for signaling that the library was not initialized.
Definition peak_afl.hpp:364
The exception thrown when a functionality is not supported.
Definition peak_afl.hpp:416
Base class for all exceptions thrown by the library.
Definition peak_common_exceptions.hpp:36
Thrown when an unexpected internal error occurs.
Definition peak_common_exceptions.hpp:82
Thrown when a cast to an incompatible type is attempted.
Definition peak_common_exceptions.hpp:93
Thrown when a function receives an invalid parameter.
Definition peak_common_exceptions.hpp:58
Thrown when the library is used before proper initialization.
Definition peak_common_exceptions.hpp:106
Thrown when an unsupported operation or feature is used.
Definition peak_common_exceptions.hpp:158
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_AutoPercentile_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if auto percentile is supported for a controller.
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_AutoPercentile_Get(peak_afl_controller_handle controller, double *percentile)
Get the auto percentile for a controller.
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_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_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_AutoTarget_Set(peak_afl_controller_handle controller, uint32_t target)
Set the auto target 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_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_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_AutoTolerance_Get(peak_afl_controller_handle controller, uint32_t *tolerance)
Get the current auto tolerance for a controller.
peak_afl_controllerType
Auto feature controller types.
Definition peak_afl.h:489
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_API_STATUS peak_afl_AutoController_Create(peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a new auto feature 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_Destroy(peak_afl_controller_handle controller)
Destroy a standalone controller.
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_AddController(peak_afl_manager_handle handle, peak_afl_controller_handle controller)
Add a controller to an auto manager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Process(peak_afl_manager_handle handle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Process an image through the auto feature pipeline.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyController(peak_afl_manager_handle handle, peak_afl_controller_handle controller)
Destroy a controller from a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Status(peak_afl_manager_handle handle, peak_afl_BOOL8 *running)
Get the processing status of an auto feature 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 associated with a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Controller_IsSupported(peak_afl_manager_handle handle, peak_afl_controllerType controllerType, peak_afl_BOOL8 *supported)
Check if a controller type is supported by the manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_SetGainIPL(peak_afl_manager_handle handle, PEAK_IPL_GAIN_HANDLE gainHandle)
Set the IPL Gain for image processing.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_RemoveController(peak_afl_manager_handle handle, peak_afl_controller_handle controller)
Remove a controller from an auto feature manager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_SetCCM(peak_afl_manager_handle handle, float *ccm, size_t ccmSize)
Set the Color Correction Matrix (CCM)
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessAlgorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_algorithm algorithm)
Set the brightness analysis algorithm for a controller.
peak_afl_controller_brightness_algorithm
Brightness calculation algorithms.
Definition peak_afl.h:772
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessAlgorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_brightness_algorithm *algorithm)
Get the current brightness analysis algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessAlgorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if brightness algorithm configuration is supported 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 function for a specific brightness component.
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 operational status for a specific brightness component.
peak_afl_controller_brightness_component
Brightness control components.
Definition peak_afl.h:877
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Unit_IsSupported(peak_afl_controller_handle controller, peak_afl_controller_brightness_component unit, peak_afl_BOOL8 *supported)
Check if a specific brightness component unit is supported for a controller.
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_ANALOG_GAIN
Analog gain control.
Definition peak_afl.h:919
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_GAIN
Generic gain control.
Definition peak_afl.h:907
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_COMBINED_GAIN
Combined analog and digital gain.
Definition peak_afl.h:943
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_HOST_GAIN
Host-based software gain.
Definition peak_afl.h:955
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_DIGITAL_GAIN
Digital gain control.
Definition peak_afl.h:931
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_EXPOSURE
Camera exposure time control.
Definition peak_afl.h:896
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 automatic mode for a specific brightness component.
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 automatic mode for a specific brightness component.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if brightness component mode configuration is supported for a controller.
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_Callback_Set(peak_afl_controller_handle controller, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller.
@ PEAK_AFL_CONTROLLER_CALLBACK_FINISHED
Controller operation finished callback.
Definition peak_afl.h:1086
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA
Legacy processing data callback.
Definition peak_afl.h:1100
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING
Enhanced processing callback.
Definition peak_afl.h:1111
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_automode *mode)
Get the current automatic processing mode for a controller.
peak_afl_controller_automode
Auto feature controller operation modes.
Definition peak_afl.h:543
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if automatic mode configuration 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 automatic processing mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set exposure time limits for automatic exposure control.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get the current exposure time limits for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature exposure limit range for a controller.
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_controller_algorithm
Focus search algorithms.
Definition peak_afl.h:695
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_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_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_Limit_Default(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature default limit.
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_Limit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if limit is supported for 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_GainAnalogLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature analog gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainAnalogLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature analog gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainAnalogLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature analog gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainCombinedLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature combined gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainCombinedLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature combined gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainCombinedLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature combined gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainDigitalLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature digital gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainDigitalLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature digital gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainDigitalLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature digital gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainHostLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature host gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainHostLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature host gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainHostLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature host gain limit range 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_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_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_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_Hysteresis_Set(peak_afl_controller_handle controller, uint8_t hysteresis)
Set the autofeature hysteresis 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_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_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_roi_preset
Predefined ROI preset configurations.
Definition peak_afl.h:1410
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_Set(peak_afl_controller_handle controller, peak_afl_roi_preset roiPreset)
Set a predefined region of interest preset 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 feature is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Get(peak_afl_controller_handle controller, peak_afl_rectangle *roi)
Get the current region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Set(peak_afl_controller_handle controller, peak_afl_rectangle roi)
Set the region of interest for automatic feature processing.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if region of interest (ROI) feature is supported 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_SharpnessAlgorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
peak_afl_controller_sharpness_algorithm
Focus sharpness calculation algorithms.
Definition peak_afl.h:808
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_SharpnessAlgorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if setting a sharpness algorithm is supported by a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the valid range for skip frames count.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Set(peak_afl_controller_handle controller, uint32_t count)
Set number of frames to skip for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Get(peak_afl_controller_handle controller, uint32_t *count)
Get the current skip frames count 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 feature is supported for a controller.
peak_afl_status
Auto feature library status codes.
Definition peak_afl.h:383
peak_afl_controller_status
Controller operational status.
Definition peak_afl.h:589
@ PEAK_AFL_STATUS_SUCCESS
Operation completed successfully.
Definition peak_afl.h:389
@ PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT
Invalid or unsupported image format.
Definition peak_afl.h:457
@ PEAK_AFL_STATUS_VALUE_ADJUSTED
Parameter value was adjusted.
Definition peak_afl.h:475
@ PEAK_AFL_STATUS_ACCESS_DENIED
Access denied to resource.
Definition peak_afl.h:427
@ PEAK_AFL_STATUS_BUSY
Resource is busy.
Definition peak_afl.h:437
@ PEAK_AFL_STATUS_NOT_SUPPORTED
Feature or operation not supported.
Definition peak_afl.h:465
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:419
@ PEAK_AFL_STATUS_BUFFER_TOO_SMALL
Provided buffer is too small.
Definition peak_afl.h:447
@ PEAK_AFL_STATUS_NOT_INITIALIZED
Library not initialized.
Definition peak_afl.h:409
@ PEAK_AFL_STATUS_ERROR
General error occurred.
Definition peak_afl.h:399
#define PEAK_AFL_FALSE
Boolean false value.
Definition peak_afl.h:1646
uint8_t peak_afl_BOOL8
Custom 8-bit boolean type.
Definition peak_afl.h:1628
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_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_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_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.
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:872
std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:2175
void Exit()
Exit the peak_afl auto feature library.
Definition peak_afl.hpp:2153
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:2143
Version_t Version()
Query the library version.
Definition peak_afl.hpp:2162
C API interface for automatic camera feature control.
void * peak_afl_controller_handle
Opaque handle for auto feature controllers.
Definition peak_afl.h:357
void * peak_afl_manager_handle
Opaque handle for auto feature managers.
Definition peak_afl.h:369
Generic arithmetic range with inclusive endpoints and a defined step size.
Definition peak_afl.hpp:897
Version information for ids_peak_afl.
Definition peak_afl.hpp:131
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:170
std::string ToString() const
Patch.
Definition peak_afl.hpp:141
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:151
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:161
std::uint32_t minor
Major.
Definition peak_afl.hpp:133
std::uint32_t subminor
Minor.
Definition peak_afl.hpp:134
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:180
std::uint32_t patch
Subminor.
Definition peak_afl.hpp:135
Controller parameter limit range.
Definition peak_afl.h:1569
Floating-point parameter limit range.
Definition peak_afl.h:1599
Generic process data structure.
Definition peak_afl.h:1129
2D rectangle structure
Definition peak_afl.h:1497
2D size structure
Definition peak_afl.h:1435
Weighted region of interest for focus control.
Definition peak_afl.h:1539