IDS peak AFL v2.1.0
Loading...
Searching...
No Matches
peak_afl.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9
10#ifdef PEAK_AFL_DYNAMIC_LOADING
11# define PEAK_AFL_C_ABI_PREFIX peak::afl::dynamic::DynamicLoader::
12#else
13# define PEAK_AFL_C_ABI_PREFIX // we could also set ::
14#endif
15
16#include <peak_afl/peak_afl.h>
18#include <peak_ipl/algorithm/peak_ipl_gain.hpp>
19#include <peak_ipl/types/peak_ipl_image.hpp>
20#include <peak/node_map/peak_node_map.hpp>
21
22#include <type_traits>
23#include <array>
24#include <cstdint>
25#include <exception>
26#include <functional>
27#include <memory>
28#include <string>
29#include <tuple>
30#include <utility>
31#include <vector>
32
33#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))
34# define PEAK_AFL_NO_DISCARD [[nodiscard]]
35# define PEAK_AFL_MAYBE_UNUSED [[maybe_unused]]
36#else
37# ifdef _MSC_VER
38# define PEAK_AFL_NO_DISCARD _Check_return_
39# define PEAK_AFL_MAYBE_UNUSED
40# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
41# define PEAK_AFL_NO_DISCARD __attribute__((warn_unused_result))
42# define PEAK_AFL_MAYBE_UNUSED __attribute__((unused))
43# else
44# define PEAK_AFL_NO_DISCARD
45# define PEAK_AFL_MAYBE_UNUSED
46# endif
47#endif
48
53
60
67
74
81
90
99
106
113
114
115namespace peak
116{
117namespace afl
118{
119namespace library
120{
121
122#include <string>
123#include <cstdint>
124
129struct Version_t
130{
131
132 PEAK_COMMON_BEGIN_DISABLE_DEPRECATED_WARNINGS
133 Version_t() = default;
134 Version_t(Version_t& other) = default;
135 Version_t(Version_t&& other) noexcept = default;
136 Version_t& operator=(const Version_t& other) = default;
137 Version_t& operator=(Version_t&& other) noexcept = default;
138
139 Version_t(std::uint32_t maj, std::uint32_t min, std::uint32_t pat)
140 : major(maj), minor(min), patch(pat), m_major(maj), m_minor(min), m_patch(pat) {}
141
145 PEAK_COMMON_DEPRECATED_MSG("Deprecated due to SemVer 2.0 migration. Use the 3-argument constructor instead.")
146 Version_t(std::uint32_t maj, std::uint32_t min, std::uint32_t submin, std::uint32_t pat)
147 : major(maj), minor(min), subminor(submin), patch(pat), m_major(maj), m_minor(min), m_patch(pat) {}
148
149 PEAK_COMMON_END_DISABLE_DEPRECATED_WARNINGS
150
154 PEAK_COMMON_DEPRECATED_MSG("Use Major() method instead.")
155 std::uint32_t major{};
156
160 PEAK_COMMON_DEPRECATED_MSG("Use Minor() method instead.")
161 std::uint32_t minor{};
162
166 PEAK_COMMON_DEPRECATED_MSG("Deprecated due to SemVer 2.0 migration.")
167 std::uint32_t subminor{};
168
172 PEAK_COMMON_DEPRECATED_MSG("Use Patch() method instead.")
173 std::uint32_t patch{};
174
179 PEAK_AFL_NO_DISCARD std::string ToString() const
180 {
181 return std::to_string(m_major) + "." + std::to_string(m_minor) + "." + std::to_string(m_patch);
182 }
183
189 PEAK_AFL_NO_DISCARD std::uint32_t Major() const
190 {
191 return m_major;
192 }
193
199 PEAK_AFL_NO_DISCARD std::uint32_t Minor() const
200 {
201 return m_minor;
202 }
203
207 PEAK_COMMON_DEPRECATED_MSG("Deprecated due to SemVer 2.0 migration. Use Major(), Minor() and Patch() methods.")
208 PEAK_AFL_NO_DISCARD std::uint32_t Subminor() const
209 {
210 PEAK_COMMON_BEGIN_DISABLE_DEPRECATED_WARNINGS
211 return subminor;
212 PEAK_COMMON_END_DISABLE_DEPRECATED_WARNINGS
213 }
214
220 PEAK_AFL_NO_DISCARD std::uint32_t Patch() const
221 {
222 return m_patch;
223 }
224
225private:
226 std::uint32_t m_major{};
227 std::uint32_t m_minor{};
228 std::uint32_t m_patch{};
229};
230
246inline void Init();
247
263inline void Exit();
264
273PEAK_AFL_NO_DISCARD inline std::string GetLastError();
274
289PEAK_AFL_NO_DISCARD inline Version_t Version();
290} // namespace library
291
292
293namespace error
294{
295
300class Exception : public virtual peak::common::Exception
301{
302public:
303 explicit Exception(const std::string& string, peak_afl_status code)
305 , m_code(code)
306 {}
307
308 explicit Exception(const char* string, peak_afl_status code)
310 , m_code(code)
311 {}
312
320 PEAK_AFL_NO_DISCARD peak_afl_status code() const
321 {
322 return m_code;
323 }
324
334 PEAK_AFL_NO_DISCARD static std::string translateCode(peak_afl_status status)
335 {
336 switch (status)
337 {
339 return "PEAK_AFL_STATUS_SUCCESS";
340
342 return "PEAK_AFL_STATUS_ERROR";
343
345 return "PEAK_AFL_STATUS_NOT_INITIALIZED";
346
348 return "PEAK_AFL_STATUS_INVALID_PARAMETER";
349
351 return "PEAK_AFL_STATUS_ACCESS_DENIED";
352
354 return "PEAK_AFL_STATUS_BUSY";
355
357 return "PEAK_AFL_STATUS_BUFFER_TOO_SMALL";
358
360 return "PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT";
361
363 return "PEAK_AFL_STATUS_NOT_SUPPORTED";
364
366 return "PEAK_AFL_STATUS_VALUE_ADJUSTED";
367 }
368
369 return "Unknown Status code";
370 }
371
372private:
373 peak_afl_status m_code{};
374};
375
382class InternalErrorException
383 : public Exception
385{
386public:
387 explicit InternalErrorException(const std::string& string, peak_afl_status code)
389 , Exception(string, code)
391 {}
392
393 explicit InternalErrorException(const char* string, peak_afl_status code)
395 , Exception(string, code)
397 {}
398};
399
406class NotInitializedException
407 : public Exception
409{
410public:
411 explicit NotInitializedException(const std::string& string, peak_afl_status code)
413 , Exception(string, code)
415 {}
416
417 explicit NotInitializedException(const char* string, peak_afl_status code)
419 , Exception(string, code)
421 {}
422};
423
433class InvalidParameterException
434 : public Exception
436{
437public:
438 explicit InvalidParameterException(const std::string& string, peak_afl_status code)
440 , Exception(string, code)
442 {}
443
444 explicit InvalidParameterException(const char* string, peak_afl_status code)
446 , Exception(string, code)
448 {}
449};
450
458class NotSupportedException
459 : public Exception
461{
462public:
463 explicit NotSupportedException(const std::string& string, peak_afl_status code)
465 , Exception(string, code)
467 {}
468
469 explicit NotSupportedException(const char* string, peak_afl_status code)
471 , Exception(string, code)
473 {}
474};
475
482class BusyException : public Exception
483{
484public:
485 explicit BusyException(const std::string& string, peak_afl_status code)
487 , Exception(string, code)
488 {}
489
490 explicit BusyException(const char* string, peak_afl_status code)
492 , Exception(string, code)
493 {}
494};
495
505class InvalidImageFormatException : public Exception
506{
507public:
508 explicit InvalidImageFormatException(const std::string& string, peak_afl_status code)
510 , Exception(string, code)
511 {}
512
513 explicit InvalidImageFormatException(const char* string, peak_afl_status code)
515 , Exception(string, code)
516 {}
517};
518
526class BadAccessException : public Exception
527{
528public:
529 explicit BadAccessException(const std::string& string, peak_afl_status code)
531 , Exception(string, code)
532 {}
533
534 explicit BadAccessException(const char* string, peak_afl_status code)
536 , Exception(string, code)
537 {}
538};
539
546class BufferTooSmallException : public Exception
547{
548public:
549 explicit BufferTooSmallException(const std::string& string, peak_afl_status code)
551 , Exception(string, code)
552 {}
553
554 explicit BufferTooSmallException(const char* string, peak_afl_status code)
556 , Exception(string, code)
557 {}
558};
559
566class CorruptedDataException : public Exception
567{
568public:
569 explicit CorruptedDataException(const std::string& string, peak_afl_status code)
571 , Exception(string, code)
572 {}
573
574 explicit CorruptedDataException(const char* string, peak_afl_status code)
576 , Exception(string, code)
577 {}
578};
579
584class InvalidCastException
585 : public Exception
587{
588public:
589 explicit InvalidCastException(const std::string& string, peak_afl_status code)
591 , Exception(string, code)
593 {}
594
595 explicit InvalidCastException(const char* string, peak_afl_status code)
597 , Exception(string, code)
599 {}
600};
601
612static void ThrowException(peak_afl_status code, bool get_text = true)
613{
614 const auto text = get_text ? library::GetLastError() : "No additional text";
615
616 switch (code)
617 {
619 throw InternalErrorException(text, code);
620
622 throw NotInitializedException(text, code);
623
625 throw InvalidParameterException(text, code);
626
628 throw BadAccessException(text, code);
629
631 throw BusyException(text, code);
632
634 throw BufferTooSmallException(text, code);
635
637 throw InvalidImageFormatException(text, code);
638
640 throw NotSupportedException(text, code);
641
644 break;
645 }
646}
647
648} // namespace error
649
650class Controller;
651
708{
709public:
721 inline explicit Manager(const std::shared_ptr<peak::core::NodeMap>& node_map);
722
726 inline ~Manager();
727
728 Manager(const Manager&) = delete;
729 inline Manager(Manager&&) noexcept;
730
731 Manager& operator=(const Manager&) noexcept = delete;
732 inline Manager& operator=(Manager&&) noexcept;
733
746 inline void AddController(const std::shared_ptr<Controller>& controller);
747
760 inline void RemoveController(const std::shared_ptr<Controller>& controller);
761
773 inline void Process(const peak::ipl::Image& image) const;
774
789 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> CreateController(peak_afl_controllerType type);
790
800 inline void DestroyAllController();
801
811 inline void DestroyController(const std::shared_ptr<Controller>& controller);
812
822 inline void SetGainIPL(const peak::ipl::Gain& gain);
823
844 inline void SetCCM(std::array<float, 9> ccm);
845
857 PEAK_AFL_NO_DISCARD inline bool Status() const;
858
866 PEAK_AFL_NO_DISCARD inline std::vector<std::shared_ptr<Controller>> ControllerList() const;
867
875 PEAK_AFL_NO_DISCARD inline size_t ControllerCount() const;
876
888 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> GetController(peak_afl_controllerType type) const;
889
899 PEAK_AFL_NO_DISCARD inline bool IsControllerSupported(peak_afl_controllerType type) const;
900
901private:
902 std::vector<std::shared_ptr<Controller>> m_controllerList;
903 mutable std::mutex m_mutex{};
904 peak_afl_manager_handle m_handle{};
905};
906
916template <typename... ControllerTypes>
917std::tuple<Manager, std::vector<std::shared_ptr<Controller>>> CreateManager(
918 const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
919{
920 constexpr int size = sizeof...(types);
921 constexpr std::array<peak_afl_controllerType, size> controller_types{ types... };
922 std::vector<std::shared_ptr<Controller>> controller{};
923 Manager manager{ node_map };
924 controller.reserve(size);
925
926 std::for_each(controller_types.cbegin(), controller_types.cend(),
927 [&manager, &controller](peak_afl_controllerType type) { controller.emplace_back(manager.CreateController(type)); });
928
929 return { std::move(manager), std::move(controller) };
930}
931
932
940template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
941struct Range
942{
943 T min;
944 T max;
945 T inc;
946};
947
948namespace callback
949{
950using FinishedCallback = std::function<void(void)>;
951using DataProcessingCallback = std::function<void(int, int)>;
952using ProcessingCallback = std::function<void(peak_afl_process_data*)>;
953using ComponentCallback = std::function<void(void)>;
954
955using RegisterFunction = std::function<peak_afl_status(void*, void*)>;
956using UnRegisterFunction = std::function<void()>;
957} // namespace callback
958
1035class Controller : public std::enable_shared_from_this<Controller>
1036{
1037 friend class Manager;
1038
1039 template <class T>
1040 class Callback
1041 {
1042#ifndef SWIG
1043 public:
1044 template <typename R, typename... Args>
1045 Callback(const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
1046 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback)
1047 : m_unregister_function(std::move(unregister_function))
1048 , m_callback(std::move(callback))
1049 {
1050 const auto ret = register_function(reinterpret_cast<void*>(&Callback::Func<Args...>), this);
1051 if (ret != PEAK_AFL_STATUS_SUCCESS)
1052 {
1053 error::ThrowException(ret);
1054 }
1055 m_controller = controller;
1056 }
1057
1058 virtual ~Callback()
1059 {
1060 if (auto controller = m_controller.lock())
1061 {
1062 m_unregister_function();
1063 }
1064 }
1065
1066 private:
1067 template <typename... Args>
1068 static void Func(Args... args, void* ptr)
1069 {
1070 static_cast<Callback*>(ptr)->m_callback(args...);
1071 };
1072#endif
1073
1074 std::weak_ptr<peak::afl::Controller> m_controller{};
1075 callback::UnRegisterFunction m_unregister_function{};
1076 T m_callback{};
1077 };
1078
1079
1089 inline explicit Controller(peak_afl_controller_handle handle)
1090 : m_handle(handle) {};
1091
1092public:
1096 inline ~Controller();
1097
1098 Controller(const Controller&) = delete;
1099 Controller(Controller&&) = delete;
1100 Controller& operator=(const Controller&) = delete;
1101 Controller& operator=(Controller&&) = delete;
1102
1114 PEAK_AFL_NO_DISCARD inline static std::shared_ptr<Controller> Create(peak_afl_controllerType type);
1115
1125 PEAK_AFL_NO_DISCARD inline bool IsSkipFramesSupported() const;
1126
1138 inline void SetSkipFrames(std::uint32_t count);
1139
1151 PEAK_AFL_NO_DISCARD inline std::uint32_t GetSkipFrames() const;
1152
1162 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetSkipFramesRange() const;
1163
1175 PEAK_AFL_NO_DISCARD inline bool IsROISupported() const;
1176
1188 inline void SetROI(peak_afl_rectangle rect);
1189
1201 PEAK_AFL_NO_DISCARD inline peak_afl_rectangle GetROI() const;
1202
1214 PEAK_AFL_NO_DISCARD inline bool IsROIPresetSupported() const;
1215
1227 inline void SetROIPreset(peak_afl_roi_preset preset);
1228
1240 PEAK_AFL_NO_DISCARD inline bool IsModeSupported() const;
1241
1253 inline void SetMode(peak_afl_controller_automode mode);
1254
1264 PEAK_AFL_NO_DISCARD inline peak_afl_controller_automode GetMode() const;
1265
1277 PEAK_AFL_NO_DISCARD bool IsBrightnessAlgorithmSupported() const;
1278
1292
1301
1313 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status Status() const;
1314
1326 PEAK_AFL_NO_DISCARD inline std::uint8_t GetLastAutoAverage() const;
1327
1339 PEAK_AFL_NO_DISCARD inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> GetLastAutoAverages() const;
1340
1352 PEAK_AFL_NO_DISCARD inline bool IsAutoTargetSupported() const;
1353
1366 inline void SetAutoTarget(uint32_t target);
1367
1377 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTarget() const;
1378
1391 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoTargetRange() const;
1392
1404 PEAK_AFL_NO_DISCARD inline bool IsAutoToleranceSupported() const;
1405
1417 inline void SetAutoTolerance(std::uint32_t tolerance);
1418
1428 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTolerance() const;
1429
1442 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoToleranceRange() const;
1443
1455 PEAK_AFL_NO_DISCARD inline bool IsAutoPercentileSupported() const;
1456
1469 inline void SetAutoPercentile(double percentile);
1470
1480 PEAK_AFL_NO_DISCARD inline double GetAutoPercentile() const;
1481
1494 PEAK_AFL_NO_DISCARD inline Range<double> GetAutoPercentileRange() const;
1495
1507 PEAK_AFL_NO_DISCARD inline peak_afl_controllerType Type() const;
1508
1522 PEAK_AFL_NO_DISCARD inline bool IsAlgorithmSupported() const;
1523
1535 inline void SetAlgorithm(peak_afl_controller_algorithm algorithm);
1536
1544 PEAK_AFL_NO_DISCARD inline peak_afl_controller_algorithm GetAlgorithm() const;
1545
1557 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_algorithm> GetAlgorithmList() const;
1558
1570 PEAK_AFL_NO_DISCARD inline bool IsSharpnessAlgorithmSupported() const;
1571
1584
1594 PEAK_AFL_NO_DISCARD inline peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const;
1595
1607 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_sharpness_algorithm> GetSharpnessAlgorithmList() const;
1608
1618 inline void RegisterFinishedCallback(const callback::FinishedCallback& callback);
1619
1627 inline void UnRegisterFinishedCallback();
1628
1637 inline void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback);
1638
1649
1659 PEAK_AFL_DEPRECATED_ATTR inline void RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback);
1660
1668 PEAK_AFL_DEPRECATED_ATTR inline void UnRegisterDataProcessingCallback();
1669
1677 inline void RegisterProcessingCallback(const callback::ProcessingCallback& callback);
1678
1686 inline void UnRegisterProcessingCallback();
1687
1699 PEAK_AFL_NO_DISCARD inline bool IsWeightedROISupported() const;
1700
1712 inline void SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list);
1713
1725 inline void SetWeightedROI(const peak_afl_weighted_rectangle& rect);
1726
1736 PEAK_AFL_NO_DISCARD inline peak_afl_size GetWeightedROIMinSize() const;
1737
1747 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_weighted_rectangle> GetWeightedROIs() const;
1748
1760 PEAK_AFL_NO_DISCARD inline bool IsLimitSupported() const;
1761
1773 inline void SetLimit(peak_afl_controller_limit limit);
1774
1784 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetLimit() const;
1785
1795 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetDefaultLimit() const;
1796
1808 PEAK_AFL_NO_DISCARD inline bool IsHysteresisSupported() const;
1809
1821 inline void SetHysteresis(std::uint8_t hysteresis);
1822
1832 PEAK_AFL_NO_DISCARD inline std::uint8_t GetHysteresis() const;
1833
1843 PEAK_AFL_NO_DISCARD inline std::uint8_t GetDefaultHysteresis() const;
1844
1854 PEAK_AFL_NO_DISCARD inline Range<std::uint8_t> GetHysteresisRange() const;
1855
1867 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentModeSupported() const;
1868
1881 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentUnitSupported(peak_afl_controller_brightness_component component) const;
1882
1896
1909
1922 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status BrightnessComponentStatus(
1924
1934 PEAK_AFL_NO_DISCARD inline bool IsGainLimitSupported() const;
1935
1952 inline void SetGainLimit(peak_afl_double_limit limit);
1953
1963 inline peak_afl_double_limit GetGainLimit() const;
1964
1975
1991 inline void SetGainAnalogLimit(peak_afl_double_limit limit);
1992
2003
2014
2030 inline void SetGainDigitalLimit(peak_afl_double_limit limit);
2031
2042
2053
2070
2081
2092
2108 inline void SetGainHostLimit(peak_afl_double_limit limit);
2109
2120
2131
2141 inline void SetExposureLimit(peak_afl_double_limit limit);
2142
2153
2164
2165
2166private:
2167 using FinishedCallbackType = Callback<callback::FinishedCallback>;
2168 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
2169 using ProcessingCallbackType = Callback<callback::ProcessingCallback>;
2170 using ComponentCallbackType = Callback<callback::ComponentCallback>;
2171
2172 peak_afl_controller_handle m_handle{};
2173 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
2174 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
2175 std::unique_ptr<ProcessingCallbackType> m_ProcessingCallback{};
2176 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
2177
2178 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
2179
2180 std::unique_ptr<ComponentCallbackType> m_AnalogGainCallback{};
2181 std::unique_ptr<ComponentCallbackType> m_DigitalGainCallback{};
2182 std::unique_ptr<ComponentCallbackType> m_CombinedGainCallback{};
2183 std::unique_ptr<ComponentCallbackType> m_HostGainCallback{};
2184};
2185
2186namespace library
2187{
2188inline void Init()
2189{
2190 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Init();
2191 if (ret != PEAK_AFL_STATUS_SUCCESS)
2192
2193 {
2194 error::ThrowException(ret, false);
2195 }
2196}
2197
2198inline void Exit()
2199{
2200 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Exit();
2201 if (ret != PEAK_AFL_STATUS_SUCCESS)
2202 {
2203 error::ThrowException(ret, false);
2204 }
2205}
2206
2208{
2209 uint32_t major;
2210 uint32_t minor;
2211 uint32_t patch;
2212
2213 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetVersion(&major, &minor, &patch, nullptr);
2214 if (ret != PEAK_AFL_STATUS_SUCCESS)
2215 {
2216 error::ThrowException(ret, false);
2217 }
2218
2219 return Version_t{major, minor, patch};
2220}
2221
2222inline std::string GetLastError()
2223{
2224 std::size_t lastErrorMessageSize;
2225 peak_afl_status code;
2226
2227 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, nullptr, &lastErrorMessageSize);
2228 if (ret != PEAK_AFL_STATUS_SUCCESS)
2229 {
2230 return "Cannot get last error!";
2231 }
2232
2233 std::vector<char> text;
2234 text.resize(lastErrorMessageSize);
2235
2236 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, text.data(), &lastErrorMessageSize);
2237 if (ret != PEAK_AFL_STATUS_SUCCESS)
2238 {
2239 return "Cannot get last error!";
2240 }
2241
2242 return { text.begin(), text.end() };
2243}
2244} // namespace library
2245
2246inline Manager::Manager(const std::shared_ptr<peak::core::NodeMap>& node_map)
2247{
2248 if (node_map == nullptr)
2249 {
2251 }
2252
2253 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Create(&m_handle, node_map->Handle());
2254 if (ret != PEAK_AFL_STATUS_SUCCESS)
2255 {
2256 error::ThrowException(ret);
2257 }
2258}
2259
2261{
2262 if (m_handle != nullptr)
2263 {
2264 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
2265
2266 {
2267 std::lock_guard<std::mutex> lck(m_mutex);
2268 for (auto& c : m_controllerList)
2269 {
2270 c->m_handle = nullptr;
2271 }
2272 }
2273
2274 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Destroy(m_handle);
2275 m_handle = nullptr;
2276 }
2277}
2278
2279inline Manager::Manager(Manager&& other) noexcept
2280{
2281 m_handle = other.m_handle;
2282 other.m_handle = nullptr;
2283
2284 std::lock_guard<std::mutex> lck(other.m_mutex);
2285 m_controllerList = std::move(other.m_controllerList);
2286}
2287
2288inline Manager& Manager::operator=(Manager&& other) noexcept
2289{
2290 m_handle = other.m_handle;
2291 other.m_handle = nullptr;
2292
2293 std::lock_guard<std::mutex> lck(other.m_mutex);
2294 m_controllerList = std::move(other.m_controllerList);
2295
2296 return *this;
2297}
2298
2299inline void Manager::AddController(const std::shared_ptr<Controller>& controller)
2300{
2301 std::lock_guard<std::mutex> lck(m_mutex);
2302
2303 auto cnt = std::any_of(
2304 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2305
2306 if (cnt)
2307 {
2308 return;
2309 }
2310
2311 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_AddController(m_handle, controller->m_handle);
2312 if (ret != PEAK_AFL_STATUS_SUCCESS)
2313 {
2314 error::ThrowException(ret);
2315 }
2316
2317 m_controllerList.emplace_back(controller);
2318}
2319
2320inline void Manager::RemoveController(const std::shared_ptr<Controller>& controller)
2321{
2322 std::lock_guard<std::mutex> lck(m_mutex);
2323
2324 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_RemoveController(m_handle, controller->m_handle);
2325 if (ret != PEAK_AFL_STATUS_SUCCESS)
2326 {
2327 error::ThrowException(ret);
2328 }
2329
2330 auto it = std::remove_if(
2331 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2332
2333 m_controllerList.erase(it, m_controllerList.end());
2334}
2335
2336inline void Manager::Process(const peak::ipl::Image& image) const
2337{
2338 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Process(m_handle, ImageBackendAccessor::BackendHandle(image));
2339 if (ret != PEAK_AFL_STATUS_SUCCESS)
2340 {
2341 error::ThrowException(ret);
2342 }
2343}
2344
2345inline std::shared_ptr<Controller> Manager::CreateController(peak_afl_controllerType type)
2346{
2347 std::lock_guard<std::mutex> lck(m_mutex);
2348
2350 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_CreateController(m_handle, &handle, type);
2351 if (ret != PEAK_AFL_STATUS_SUCCESS)
2352 {
2353 error::ThrowException(ret);
2354 }
2355
2356 auto shared = std::shared_ptr<Controller>(new Controller(handle));
2357 m_controllerList.emplace_back(shared);
2358
2359 return shared;
2360}
2361
2363{
2364 std::lock_guard<std::mutex> lck(m_mutex);
2365
2366 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
2367 if (ret != PEAK_AFL_STATUS_SUCCESS)
2368 {
2369 error::ThrowException(ret);
2370 }
2371
2372 for (auto& c : m_controllerList)
2373 {
2374 c->m_handle = nullptr;
2375 }
2376
2377 m_controllerList.clear();
2378}
2379
2380inline void Manager::DestroyController(const std::shared_ptr<Controller>& controller)
2381{
2382 std::lock_guard<std::mutex> lck(m_mutex);
2383
2384 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyController(m_handle, controller->m_handle);
2385 if (ret != PEAK_AFL_STATUS_SUCCESS)
2386 {
2387 error::ThrowException(ret);
2388 }
2389
2390 auto it = std::remove_if(
2391 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2392
2393 m_controllerList.erase(it, m_controllerList.end());
2394
2395 controller->m_handle = nullptr;
2396}
2397
2398inline void Manager::SetGainIPL(const peak::ipl::Gain& gain)
2399{
2400 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetGainIPL(m_handle, GainBackendAccessor::BackendHandle(gain));
2401 if (ret != PEAK_AFL_STATUS_SUCCESS)
2402 {
2403 error::ThrowException(ret);
2404 }
2405}
2406
2407inline void Manager::SetCCM(std::array<float, 9> ccm)
2408{
2409 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetCCM(m_handle, ccm.data(), ccm.size());
2410 if (ret != PEAK_AFL_STATUS_SUCCESS)
2411 {
2412 error::ThrowException(ret);
2413 }
2414}
2415
2416inline bool Manager::Status() const
2417{
2418 std::uint8_t status;
2419 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Status(m_handle, &status);
2420 if (ret != PEAK_AFL_STATUS_SUCCESS)
2421 {
2422 error::ThrowException(ret);
2423 }
2424
2425 return status;
2426}
2427
2428inline std::vector<std::shared_ptr<Controller>> Manager::ControllerList() const
2429{
2430 std::lock_guard<std::mutex> lck(m_mutex);
2431
2432 std::vector<std::shared_ptr<Controller>> controller{};
2433
2434 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
2435
2436 return controller;
2437}
2438
2439inline size_t Manager::ControllerCount() const
2440{
2441 return m_controllerList.size();
2442}
2443
2444inline std::shared_ptr<Controller> Manager::GetController(peak_afl_controllerType type) const
2445{
2446 std::lock_guard<std::mutex> lck(m_mutex);
2447
2448 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(),
2449 [=](const std::shared_ptr<Controller>& controller) { return type == controller->Type(); });
2450
2451 if (it != m_controllerList.cend())
2452 {
2453 return *it;
2454 }
2455 else
2456 {
2457 throw error::InternalErrorException("No controller found!", PEAK_AFL_STATUS_ERROR);
2458 }
2459}
2460
2462{
2463 peak_afl_BOOL8 supported{};
2464 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Controller_IsSupported(m_handle, type, &supported);
2465 if (ret != PEAK_AFL_STATUS_SUCCESS)
2466 {
2467 error::ThrowException(ret);
2468 }
2469
2470 return supported != PEAK_AFL_FALSE;
2471}
2472
2473
2474inline std::shared_ptr<Controller> Controller::Create(peak_afl_controllerType type)
2475{
2477 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Create(&handle, type);
2478 if (ret != PEAK_AFL_STATUS_SUCCESS)
2479 {
2480 error::ThrowException(ret);
2481 }
2482
2483 return std::shared_ptr<Controller>(new Controller(handle));
2484}
2485
2487{
2488 if (m_handle != nullptr)
2489 {
2490 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Destroy(m_handle);
2491 m_handle = nullptr;
2492 }
2493}
2494
2496{
2497 peak_afl_BOOL8 supported{};
2498 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_IsSupported(m_handle, &supported);
2499 if (ret != PEAK_AFL_STATUS_SUCCESS)
2500 {
2501 error::ThrowException(ret);
2502 }
2503
2504 return supported;
2505}
2506
2507inline void Controller::SetSkipFrames(std::uint32_t count)
2508{
2509 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Set(m_handle, count);
2510 if (ret != PEAK_AFL_STATUS_SUCCESS)
2511 {
2512 error::ThrowException(ret);
2513 }
2514}
2515
2516inline std::uint32_t Controller::GetSkipFrames() const
2517{
2518 std::uint32_t count{};
2519 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Get(m_handle, &count);
2520 if (ret != PEAK_AFL_STATUS_SUCCESS)
2521 {
2522 error::ThrowException(ret);
2523 }
2524
2525 return count;
2526}
2527
2529{
2530 Range<std::uint32_t> range{};
2531 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_GetRange(m_handle, &range.min, &range.max, &range.inc);
2532 if (ret != PEAK_AFL_STATUS_SUCCESS)
2533 {
2534 error::ThrowException(ret);
2535 }
2536
2537 return range;
2538}
2539
2541{
2542 peak_afl_BOOL8 supported{};
2543 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_IsSupported(m_handle, &supported);
2544 if (ret != PEAK_AFL_STATUS_SUCCESS)
2545 {
2546 error::ThrowException(ret);
2547 }
2548
2549 return supported;
2550}
2551
2553{
2554 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Set(m_handle, rect);
2555 if (ret != PEAK_AFL_STATUS_SUCCESS)
2556 {
2557 error::ThrowException(ret);
2558 }
2559}
2560
2562{
2563 peak_afl_rectangle rect{};
2564 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Get(m_handle, &rect);
2565 if (ret != PEAK_AFL_STATUS_SUCCESS)
2566 {
2567 error::ThrowException(ret);
2568 }
2569 return rect;
2570}
2571
2573{
2574 peak_afl_BOOL8 supported{};
2575 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_IsSupported(m_handle, &supported);
2576 if (ret != PEAK_AFL_STATUS_SUCCESS)
2577 {
2578 error::ThrowException(ret);
2579 }
2580
2581 return supported;
2582}
2583
2585{
2586 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_Set(m_handle, preset);
2587 if (ret != PEAK_AFL_STATUS_SUCCESS)
2588 {
2589 error::ThrowException(ret);
2590 }
2591}
2592
2594{
2595 peak_afl_BOOL8 supported{};
2596 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_IsSupported(m_handle, &supported);
2597 if (ret != PEAK_AFL_STATUS_SUCCESS)
2598 {
2599 error::ThrowException(ret);
2600 }
2601
2602 return supported;
2603}
2604
2606{
2607 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Set(m_handle, mode);
2608 if (ret != PEAK_AFL_STATUS_SUCCESS)
2609 {
2610 error::ThrowException(ret);
2611 }
2612}
2613
2615{
2617 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Get(m_handle, &mode);
2618 if (ret != PEAK_AFL_STATUS_SUCCESS)
2619 {
2620 error::ThrowException(ret);
2621 }
2622 return mode;
2623}
2624
2626{
2627 peak_afl_BOOL8 supported{};
2628 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_IsSupported(m_handle, &supported);
2629 if (ret != PEAK_AFL_STATUS_SUCCESS)
2630 {
2631 error::ThrowException(ret);
2632 }
2633
2634 return supported;
2635}
2636
2638{
2639 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Set(m_handle, algorithm);
2640 if (ret != PEAK_AFL_STATUS_SUCCESS)
2641 {
2642 error::ThrowException(ret);
2643 }
2644}
2645
2647{
2649 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Get(m_handle, &algorithm);
2650 if (ret != PEAK_AFL_STATUS_SUCCESS)
2651 {
2652 error::ThrowException(ret);
2653 }
2654 return algorithm;
2655}
2656
2658{
2660 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Status(m_handle, &status);
2661 if (ret != PEAK_AFL_STATUS_SUCCESS)
2662 {
2663 error::ThrowException(ret);
2664 }
2665 return status;
2666}
2667
2668
2669inline std::uint8_t Controller::GetLastAutoAverage() const
2670{
2671 std::uint8_t average{};
2672 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverage(m_handle, &average);
2673 if (ret != PEAK_AFL_STATUS_SUCCESS)
2674 {
2675 error::ThrowException(ret);
2676 }
2677 return average;
2678}
2679
2680inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> Controller::GetLastAutoAverages() const
2681{
2682 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
2683 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverages(m_handle, &averageRed, &averageGreen, &averageBlue);
2684 if (ret != PEAK_AFL_STATUS_SUCCESS)
2685 {
2686 error::ThrowException(ret);
2687 }
2688 return { averageRed, averageGreen, averageBlue };
2689}
2690
2692{
2693 peak_afl_BOOL8 supported{};
2694 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_IsSupported(m_handle, &supported);
2695 if (ret != PEAK_AFL_STATUS_SUCCESS)
2696 {
2697 error::ThrowException(ret);
2698 }
2699
2700 return supported;
2701}
2702
2703inline void Controller::SetAutoTarget(std::uint32_t target)
2704{
2705 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Set(m_handle, target);
2706 if (ret != PEAK_AFL_STATUS_SUCCESS)
2707 {
2708 error::ThrowException(ret);
2709 }
2710}
2711
2712inline std::uint32_t Controller::GetAutoTarget() const
2713{
2714 std::uint32_t target{};
2715 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Get(m_handle, &target);
2716 if (ret != PEAK_AFL_STATUS_SUCCESS)
2717 {
2718 error::ThrowException(ret);
2719 }
2720 return target;
2721}
2722
2724{
2725 Range<std::uint32_t> range{};
2726 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_GetRange(m_handle, &range.min, &range.max, &range.inc);
2727 if (ret != PEAK_AFL_STATUS_SUCCESS)
2728 {
2729 error::ThrowException(ret);
2730 }
2731 return range;
2732}
2733
2735{
2736 peak_afl_BOOL8 supported{};
2737 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_IsSupported(m_handle, &supported);
2738 if (ret != PEAK_AFL_STATUS_SUCCESS)
2739 {
2740 error::ThrowException(ret);
2741 }
2742
2743 return supported;
2744}
2745
2746inline void Controller::SetAutoTolerance(uint32_t tolerance)
2747{
2748 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Set(m_handle, tolerance);
2749 if (ret != PEAK_AFL_STATUS_SUCCESS)
2750 {
2751 error::ThrowException(ret);
2752 }
2753}
2754
2755inline uint32_t Controller::GetAutoTolerance() const
2756{
2757 std::uint32_t tolerance;
2758 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Get(m_handle, &tolerance);
2759 if (ret != PEAK_AFL_STATUS_SUCCESS)
2760 {
2761 error::ThrowException(ret);
2762 }
2763 return tolerance;
2764}
2765
2767{
2768 Range<uint32_t> range{};
2769 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_GetRange(m_handle, &range.min, &range.max, &range.inc);
2770 if (ret != PEAK_AFL_STATUS_SUCCESS)
2771 {
2772 error::ThrowException(ret);
2773 }
2774 return range;
2775}
2776
2778{
2779 peak_afl_BOOL8 supported{};
2780 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_IsSupported(m_handle, &supported);
2781 if (ret != PEAK_AFL_STATUS_SUCCESS)
2782 {
2783 error::ThrowException(ret);
2784 }
2785
2786 return supported;
2787}
2788
2789inline void Controller::SetAutoPercentile(double percentile)
2790{
2791 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Set(m_handle, percentile);
2792 if (ret != PEAK_AFL_STATUS_SUCCESS)
2793 {
2794 error::ThrowException(ret);
2795 }
2796}
2797
2799{
2800 double percentile;
2801 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Get(m_handle, &percentile);
2802 if (ret != PEAK_AFL_STATUS_SUCCESS)
2803 {
2804 error::ThrowException(ret);
2805 }
2806 return percentile;
2807}
2808
2810{
2811 Range<double> range{};
2812 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_GetRange(m_handle, &range.min, &range.max, &range.inc);
2813 if (ret != PEAK_AFL_STATUS_SUCCESS)
2814 {
2815 error::ThrowException(ret);
2816 }
2817 return range;
2818}
2819
2821{
2823 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Type_Get(m_handle, &type);
2824 if (ret != PEAK_AFL_STATUS_SUCCESS)
2825 {
2826 error::ThrowException(ret);
2827 }
2828 return type;
2829}
2830
2832{
2833 peak_afl_BOOL8 supported{};
2834 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_IsSupported(m_handle, &supported);
2835 if (ret != PEAK_AFL_STATUS_SUCCESS)
2836 {
2837 error::ThrowException(ret);
2838 }
2839
2840 return supported;
2841}
2842
2844{
2845 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Set(m_handle, alg);
2846 if (ret != PEAK_AFL_STATUS_SUCCESS)
2847 {
2848 error::ThrowException(ret);
2849 }
2850}
2851
2853{
2855 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Get(m_handle, &alg);
2856 if (ret != PEAK_AFL_STATUS_SUCCESS)
2857 {
2858 error::ThrowException(ret);
2859 }
2860
2861 return alg;
2862}
2863
2864inline std::vector<peak_afl_controller_algorithm> Controller::GetAlgorithmList() const
2865{
2866 std::vector<peak_afl_controller_algorithm> algList{};
2867 std::uint32_t listSize{};
2868
2869 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, nullptr, &listSize);
2870 if (ret != PEAK_AFL_STATUS_SUCCESS)
2871 {
2872 error::ThrowException(ret);
2873 }
2874
2875 algList.resize(listSize);
2876
2877 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, algList.data(), &listSize);
2878 if (ret != PEAK_AFL_STATUS_SUCCESS)
2879 {
2880 error::ThrowException(ret);
2881 }
2882
2883 return algList;
2884}
2885
2887{
2888 peak_afl_BOOL8 supported{};
2889 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_IsSupported(m_handle, &supported);
2890 if (ret != PEAK_AFL_STATUS_SUCCESS)
2891 {
2892 error::ThrowException(ret);
2893 }
2894
2895 return supported;
2896}
2897
2899{
2900 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Set(m_handle, alg);
2901 if (ret != PEAK_AFL_STATUS_SUCCESS)
2902 {
2903 error::ThrowException(ret);
2904 }
2905}
2906
2908{
2910 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Get(m_handle, &alg);
2911 if (ret != PEAK_AFL_STATUS_SUCCESS)
2912 {
2913 error::ThrowException(ret);
2914 }
2915
2916 return alg;
2917}
2918
2919inline std::vector<peak_afl_controller_sharpness_algorithm> Controller::GetSharpnessAlgorithmList() const
2920{
2921 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
2922 std::uint32_t listSize{};
2923
2924 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, nullptr, &listSize);
2925 if (ret != PEAK_AFL_STATUS_SUCCESS)
2926 {
2927 error::ThrowException(ret);
2928 }
2929
2930 algList.resize(listSize);
2931
2932 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, algList.data(), &listSize);
2933 if (ret != PEAK_AFL_STATUS_SUCCESS)
2934 {
2935 error::ThrowException(ret);
2936 }
2937
2938 return algList;
2939}
2940
2941inline void Controller::RegisterFinishedCallback(const callback::FinishedCallback& callback)
2942{
2943 m_finishedCallback = std::make_unique<FinishedCallbackType>(
2944 shared_from_this(),
2945 [handle = m_handle](void* ptr, void* ctx) {
2946 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx);
2947 },
2948 [handle = m_handle] {
2949 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
2950 handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr);
2951 },
2952 callback);
2953}
2954
2956{
2957 m_finishedCallback.reset();
2958}
2959
2961 peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback)
2962{
2964 {
2965 throw error::NotSupportedException("Brightness component not supported!", PEAK_AFL_STATUS_NOT_SUPPORTED);
2966 }
2967
2968 const auto registerCallback = [&](peak_afl_controller_brightness_component component) {
2969 return std::make_unique<ComponentCallbackType>(
2970 shared_from_this(),
2971 [handle = m_handle, component](void* ptr, void* ctx) {
2973 handle, component, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx);
2974 },
2975 [handle = m_handle, component] {
2977 handle, component, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr);
2978 },
2979 callback);
2980 };
2981
2982 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
2984 {
2985 m_finishedExposureCallback = registerCallback(component);
2986 }
2988 {
2989 m_finishedGainCallback = registerCallback(component);
2990 }
2992 {
2993 m_AnalogGainCallback = registerCallback(component);
2994 }
2996 {
2997 m_DigitalGainCallback = registerCallback(component);
2998 }
3000 {
3001 m_CombinedGainCallback = registerCallback(component);
3002 }
3004 {
3005 m_HostGainCallback = registerCallback(component);
3006 }
3007 else
3008 {
3009 throw error::InvalidParameterException("Brightness component type is invalid!", PEAK_AFL_STATUS_INVALID_PARAMETER);
3010 }
3011 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
3012}
3013
3015{
3016 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
3018 {
3019 m_finishedExposureCallback.reset();
3020 }
3022 {
3023 m_finishedGainCallback.reset();
3024 }
3026 {
3027 m_AnalogGainCallback.reset();
3028 }
3030 {
3031 m_DigitalGainCallback.reset();
3032 }
3034 {
3035 m_CombinedGainCallback.reset();
3036 }
3038 {
3039 m_HostGainCallback.reset();
3040 }
3041 else
3042 {
3043 throw error::InvalidParameterException("Brightness component type is invalid!", PEAK_AFL_STATUS_INVALID_PARAMETER);
3044 }
3045 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
3046}
3047
3048inline void Controller::RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback)
3049{
3050 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
3051 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(
3052 shared_from_this(),
3053 [handle = m_handle](void* ptr, void* ctx) {
3054 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3056 },
3057 [handle = m_handle] {
3058 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3059 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, nullptr, nullptr);
3060 },
3061 callback);
3062 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
3063}
3064
3065inline void Controller::RegisterProcessingCallback(const callback::ProcessingCallback& callback)
3066{
3067 m_ProcessingCallback = std::make_unique<ProcessingCallbackType>(
3068 shared_from_this(),
3069 [handle = m_handle](void* ptr, void* ctx) {
3070 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3071 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING, ptr, ctx);
3072 },
3073 [handle = m_handle] {
3074 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3075 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING, nullptr, nullptr);
3076 },
3077 callback);
3078}
3079
3081{
3082 m_ProcessingCallback.reset();
3083}
3084
3086{
3087 m_dataProcessingCallback.reset();
3088}
3089
3091{
3092 peak_afl_BOOL8 supported{};
3093 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_IsSupported(m_handle, &supported);
3094 if (ret != PEAK_AFL_STATUS_SUCCESS)
3095 {
3096 error::ThrowException(ret);
3097 }
3098
3099 return supported;
3100}
3101
3102inline void Controller::SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list)
3103{
3104 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(
3105 m_handle, list.data(), static_cast<uint32_t>(list.size()));
3106 if (ret != PEAK_AFL_STATUS_SUCCESS)
3107 {
3108 error::ThrowException(ret);
3109 }
3110}
3111
3113{
3114 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, &rect, 1);
3115 if (ret != PEAK_AFL_STATUS_SUCCESS)
3116 {
3117 error::ThrowException(ret);
3118 }
3119}
3120
3122{
3123 peak_afl_size minSize{};
3124 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Min_Size(m_handle, &minSize);
3125 if (ret != PEAK_AFL_STATUS_SUCCESS)
3126 {
3127 error::ThrowException(ret);
3128 }
3129 return minSize;
3130}
3131
3132inline std::vector<peak_afl_weighted_rectangle> Controller::GetWeightedROIs() const
3133{
3134 std::vector<peak_afl_weighted_rectangle> list;
3135 std::uint32_t listSize{};
3136
3137 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, nullptr, &listSize);
3138 if (ret != PEAK_AFL_STATUS_SUCCESS)
3139 {
3140 error::ThrowException(ret);
3141 }
3142
3143 list.resize(listSize);
3144
3145 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, list.data(), &listSize);
3146 if (ret != PEAK_AFL_STATUS_SUCCESS)
3147 {
3148 error::ThrowException(ret);
3149 }
3150
3151 return list;
3152}
3153
3155{
3156 peak_afl_BOOL8 supported{};
3157 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_IsSupported(m_handle, &supported);
3158 if (ret != PEAK_AFL_STATUS_SUCCESS)
3159 {
3160 error::ThrowException(ret);
3161 }
3162
3163 return supported;
3164}
3165
3167{
3168 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Set(m_handle, limit);
3169 if (ret != PEAK_AFL_STATUS_SUCCESS)
3170 {
3171 error::ThrowException(ret);
3172 }
3173}
3174
3176{
3178 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Get(m_handle, &limit);
3179 if (ret != PEAK_AFL_STATUS_SUCCESS)
3180 {
3181 error::ThrowException(ret);
3182 }
3183 return limit;
3184}
3185
3187{
3189 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Default(m_handle, &limit);
3190 if (ret != PEAK_AFL_STATUS_SUCCESS)
3191 {
3192 error::ThrowException(ret);
3193 }
3194 return limit;
3195}
3196
3198{
3199 peak_afl_BOOL8 supported{};
3200 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_IsSupported(m_handle, &supported);
3201 if (ret != PEAK_AFL_STATUS_SUCCESS)
3202 {
3203 error::ThrowException(ret);
3204 }
3205
3206 return supported;
3207}
3208
3209inline void Controller::SetHysteresis(std::uint8_t hysteresis)
3210{
3211 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Set(m_handle, hysteresis);
3212 if (ret != PEAK_AFL_STATUS_SUCCESS)
3213 {
3214 error::ThrowException(ret);
3215 }
3216}
3217
3218inline std::uint8_t Controller::GetHysteresis() const
3219{
3220 std::uint8_t hysteresis{};
3221 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Get(m_handle, &hysteresis);
3222 if (ret != PEAK_AFL_STATUS_SUCCESS)
3223 {
3224 error::ThrowException(ret);
3225 }
3226
3227 return hysteresis;
3228}
3229
3230inline std::uint8_t Controller::GetDefaultHysteresis() const
3231{
3232 std::uint8_t hysteresis{};
3233 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Default(m_handle, &hysteresis);
3234 if (ret != PEAK_AFL_STATUS_SUCCESS)
3235 {
3236 error::ThrowException(ret);
3237 }
3238
3239 return hysteresis;
3240}
3241
3243{
3244 Range<std::uint8_t> hysteresis{};
3245 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_GetRange(
3246 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
3247 if (ret != PEAK_AFL_STATUS_SUCCESS)
3248 {
3249 error::ThrowException(ret);
3250 }
3251
3252 return hysteresis;
3253}
3254
3255PEAK_AFL_NO_DISCARD inline bool Controller::IsBrightnessComponentModeSupported() const
3256{
3257 peak_afl_BOOL8 supported{};
3258 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(m_handle, &supported);
3259 if (ret != PEAK_AFL_STATUS_SUCCESS)
3260 {
3261 error::ThrowException(ret);
3262 }
3263
3264 return supported;
3265}
3266
3269{
3270 peak_afl_BOOL8 supported{};
3271 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Unit_IsSupported(m_handle, component, &supported);
3272 if (ret != PEAK_AFL_STATUS_SUCCESS)
3273 {
3274 error::ThrowException(ret);
3275 }
3276
3277 return supported;
3278}
3279
3282{
3283 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Set(m_handle, component, mode);
3284 if (ret != PEAK_AFL_STATUS_SUCCESS)
3285 {
3286 error::ThrowException(ret);
3287 }
3288}
3289
3292{
3294 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Get(m_handle, component, &mode);
3295 if (ret != PEAK_AFL_STATUS_SUCCESS)
3296 {
3297 error::ThrowException(ret);
3298 }
3299 return mode;
3300}
3301
3304{
3306 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Status(m_handle, component, &status);
3307 if (ret != PEAK_AFL_STATUS_SUCCESS)
3308 {
3309 error::ThrowException(ret);
3310 }
3311 return status;
3312}
3313
3315{
3316 peak_afl_BOOL8 supported{};
3317 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_IsSupported(m_handle, &supported);
3318 if (ret != PEAK_AFL_STATUS_SUCCESS)
3319 {
3320 error::ThrowException(ret);
3321 }
3322
3323 return supported;
3324}
3325
3327{
3328 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Set(m_handle, limit);
3330 {
3331 // Do nothing. Not an error.
3332 }
3333 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3334 {
3335 error::ThrowException(ret);
3336 }
3337}
3338
3340{
3341 peak_afl_double_limit limit{};
3342 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Get(m_handle, &limit);
3343 if (ret != PEAK_AFL_STATUS_SUCCESS)
3344 {
3345 error::ThrowException(ret);
3346 }
3347
3348 return limit;
3349}
3350
3352{
3353 peak_afl_double_limit limit{};
3354 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_GetRange(m_handle, &limit);
3355 if (ret != PEAK_AFL_STATUS_SUCCESS)
3356 {
3357 error::ThrowException(ret);
3358 }
3359
3360 return limit;
3361}
3362
3364{
3365 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Set(m_handle, limit);
3367 {
3368 // Do nothing. Not an error.
3369 }
3370 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3371 {
3372 error::ThrowException(ret);
3373 }
3374}
3375
3377{
3378 peak_afl_double_limit limit{};
3379 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Get(m_handle, &limit);
3380 if (ret != PEAK_AFL_STATUS_SUCCESS)
3381 {
3382 error::ThrowException(ret);
3383 }
3384
3385 return limit;
3386}
3387
3389{
3390 peak_afl_double_limit limit{};
3391 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_GetRange(m_handle, &limit);
3392 if (ret != PEAK_AFL_STATUS_SUCCESS)
3393 {
3394 error::ThrowException(ret);
3395 }
3396
3397 return limit;
3398}
3399
3401{
3402 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Set(m_handle, limit);
3404 {
3405 // Do nothing. Not an error.
3406 }
3407 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3408 {
3409 error::ThrowException(ret);
3410 }
3411}
3412
3414{
3415 peak_afl_double_limit limit{};
3416 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Get(m_handle, &limit);
3417 if (ret != PEAK_AFL_STATUS_SUCCESS)
3418 {
3419 error::ThrowException(ret);
3420 }
3421
3422 return limit;
3423}
3424
3426{
3427 peak_afl_double_limit limit{};
3428 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_GetRange(m_handle, &limit);
3429 if (ret != PEAK_AFL_STATUS_SUCCESS)
3430 {
3431 error::ThrowException(ret);
3432 }
3433
3434 return limit;
3435}
3436
3438{
3439 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Set(m_handle, limit);
3441 {
3442 // Do nothing. Not an error.
3443 }
3444 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3445 {
3446 error::ThrowException(ret);
3447 }
3448}
3449
3451{
3452 peak_afl_double_limit limit{};
3453 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Get(m_handle, &limit);
3454 if (ret != PEAK_AFL_STATUS_SUCCESS)
3455 {
3456 error::ThrowException(ret);
3457 }
3458
3459 return limit;
3460}
3461
3463{
3464 peak_afl_double_limit limit{};
3465 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_GetRange(m_handle, &limit);
3466 if (ret != PEAK_AFL_STATUS_SUCCESS)
3467 {
3468 error::ThrowException(ret);
3469 }
3470
3471 return limit;
3472}
3473
3475{
3476 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Set(m_handle, limit);
3478 {
3479 // Do nothing. Not an error.
3480 }
3481 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3482 {
3483 error::ThrowException(ret);
3484 }
3485}
3486
3488{
3489 peak_afl_double_limit limit{};
3490 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Get(m_handle, &limit);
3491 if (ret != PEAK_AFL_STATUS_SUCCESS)
3492 {
3493 error::ThrowException(ret);
3494 }
3495
3496 return limit;
3497}
3498
3500{
3501 peak_afl_double_limit limit{};
3502 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_GetRange(m_handle, &limit);
3503 if (ret != PEAK_AFL_STATUS_SUCCESS)
3504 {
3505 error::ThrowException(ret);
3506 }
3507
3508 return limit;
3509}
3510
3512{
3513 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Set(m_handle, limit);
3514 if (ret != PEAK_AFL_STATUS_SUCCESS)
3515 {
3516 error::ThrowException(ret);
3517 }
3518}
3519
3521{
3522 peak_afl_double_limit limit{};
3523 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Get(m_handle, &limit);
3524 if (ret != PEAK_AFL_STATUS_SUCCESS)
3525 {
3526 error::ThrowException(ret);
3527 }
3528
3529 return limit;
3530}
3531
3533{
3534 peak_afl_double_limit limit{};
3535 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_GetRange(m_handle, &limit);
3536 if (ret != PEAK_AFL_STATUS_SUCCESS)
3537 {
3538 error::ThrowException(ret);
3539 }
3540
3541 return limit;
3542}
3543
3544} /* namespace afl */
3545} /* namespace peak */
High-level interface for automatic camera feature control, providing access to algorithms such as aut...
Definition peak_afl.hpp:1036
peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:2820
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:2584
void SetBrightnessAlgorithm(peak_afl_controller_brightness_algorithm algorithm)
Set the autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:2637
bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:2777
bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:2734
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:3339
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:3326
std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:3230
std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:3218
void SetGainCombinedLimit(peak_afl_double_limit limit)
Set the combined gain limit for a controller.
Definition peak_afl.hpp:3437
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:2605
bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:2540
void SetGainHostLimit(peak_afl_double_limit limit)
Set the host gain limit for a controller.
Definition peak_afl.hpp:3474
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3102
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2955
peak_afl_double_limit GetGainDigitalLimit() const
Get autofeature digital gain limit for a controller.
Definition peak_afl.hpp:3413
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:3290
Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:2528
bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:2572
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:3280
std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:2669
peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:3175
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:3209
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:3511
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:2507
std::vector< peak_afl_controller_sharpness_algorithm > GetSharpnessAlgorithmList() const
Get the list of supported sharpness algorithms for a controller.
Definition peak_afl.hpp:2919
bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:2593
Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:2766
void SetGainAnalogLimit(peak_afl_double_limit limit)
Set the analog gain limit for a controller.
Definition peak_afl.hpp:3363
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:2789
void UnRegisterProcessingCallback()
Reset the data callback for a controller.
Definition peak_afl.hpp:3080
peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:2561
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:3520
void UnRegisterDataProcessingCallback()
Reset the data callback for a controller.
Definition peak_afl.hpp:3085
peak_afl_double_limit GetGainCombinedLimitRange() const
Get autofeature combined gain limit range for a controller.
Definition peak_afl.hpp:3462
std::vector< peak_afl_controller_algorithm > GetAlgorithmList() const
Get the list of supported algorithms for a controller.
Definition peak_afl.hpp:2864
~Controller()
Definition peak_afl.hpp:2486
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:3048
bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:2886
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:3014
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:2680
std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:2755
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:2843
peak_afl_double_limit GetGainDigitalLimitRange() const
Get autofeature digital gain limit range for a controller.
Definition peak_afl.hpp:3425
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:2552
peak_afl_double_limit GetGainAnalogLimitRange() const
Get autofeature analog gain limit range for a controller.
Definition peak_afl.hpp:3388
bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:2495
peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:3186
bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:3154
peak_afl_size GetWeightedROIMinSize() const
Get the autofeature minimum size of weighted region of interest for a controller.
Definition peak_afl.hpp:3121
peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:2614
static std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:2474
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:2941
peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:2852
bool IsBrightnessAlgorithmSupported() const
Check if auto brightness algorithm is supported for a controller.
Definition peak_afl.hpp:2625
peak_afl_double_limit GetGainCombinedLimit() const
Get autofeature combined gain limit for a controller.
Definition peak_afl.hpp:3450
bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:3314
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:3351
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3112
std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:2516
peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2907
peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:2657
void SetGainDigitalLimit(peak_afl_double_limit limit)
Set the digital gain limit for a controller.
Definition peak_afl.hpp:3400
bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:2831
Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:2809
peak_afl_double_limit GetExposureLimitRange() const
Get autofeature exposure limit range for a controller.
Definition peak_afl.hpp:3532
double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:2798
peak_afl_controller_brightness_algorithm GetBrightnessAlgorithm() const
Get the current autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:2646
peak_afl_double_limit GetGainAnalogLimit() const
Get autofeature analog gain limit for a controller.
Definition peak_afl.hpp:3376
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:2703
peak_afl_double_limit GetGainHostLimit() const
Get autofeature host gain limit for a controller.
Definition peak_afl.hpp:3487
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:2746
std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:2712
Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:2723
Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:3242
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:3166
bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:3090
bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:3197
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:2960
bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:3255
peak_afl_controller_status BrightnessComponentStatus(peak_afl_controller_brightness_component component) const
Get the status for a brightness controller component.
Definition peak_afl.hpp:3302
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2898
void RegisterProcessingCallback(const callback::ProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:3065
peak_afl_double_limit GetGainHostLimitRange() const
Get autofeature host gain limit range for a controller.
Definition peak_afl.hpp:3499
bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:2691
std::vector< peak_afl_weighted_rectangle > GetWeightedROIs() const
Get the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3132
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:3267
Central coordination object for automatic camera feature control.
Definition peak_afl.hpp:708
bool IsControllerSupported(peak_afl_controllerType type) const
Get if the given controller type is supported.
Definition peak_afl.hpp:2461
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:2246
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:2320
std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:2444
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:2362
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:2380
std::shared_ptr< Controller > CreateController(peak_afl_controllerType type)
Create a controller and append it to Manager.
Definition peak_afl.hpp:2345
void SetCCM(std::array< float, 9 > ccm)
Set the Color Correction Matrix (CCM)
Definition peak_afl.hpp:2407
size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:2439
bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:2416
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:2260
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:2398
std::vector< std::shared_ptr< Controller > > ControllerList() const
Get the list of the controller associated with the manager.
Definition peak_afl.hpp:2428
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:2299
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:2336
The exception thrown for signaling an access error.
Definition peak_afl.hpp:527
The exception thrown when the supplied buffer is too small.
Definition peak_afl.hpp:547
The exception thrown for signaling a busy operation.
Definition peak_afl.hpp:483
static std::string translateCode(peak_afl_status status)
Get a string representation for an error code.
Definition peak_afl.hpp:334
peak_afl_status code() const
Get the return code for the failure.
Definition peak_afl.hpp:320
The exception thrown for signaling an unspecified error.
Definition peak_afl.hpp:385
The exception thrown for signaling an invalid image format.
Definition peak_afl.hpp:506
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:436
The exception thrown for signaling that the library was not initialized.
Definition peak_afl.hpp:409
The exception thrown when a functionality is not supported.
Definition peak_afl.hpp:461
Base class for all exceptions thrown by the library.
Definition peak_common_exceptions.hpp:31
Thrown when an unexpected internal error occurs.
Definition peak_common_exceptions.hpp:77
Thrown when a cast to an incompatible type is attempted.
Definition peak_common_exceptions.hpp:88
Thrown when a function receives an invalid parameter.
Definition peak_common_exceptions.hpp:53
Thrown when the library is used before proper initialization.
Definition peak_common_exceptions.hpp:101
Thrown when an unsupported operation or feature is used.
Definition peak_common_exceptions.hpp:153
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:486
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:769
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:874
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:916
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_GAIN
Generic gain control.
Definition peak_afl.h:904
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_COMBINED_GAIN
Combined analog and digital gain.
Definition peak_afl.h:940
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_HOST_GAIN
Host-based software gain.
Definition peak_afl.h:952
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_DIGITAL_GAIN
Digital gain control.
Definition peak_afl.h:928
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_EXPOSURE
Camera exposure time control.
Definition peak_afl.h:893
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:1083
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA
Legacy processing data callback.
Definition peak_afl.h:1097
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING
Enhanced processing callback.
Definition peak_afl.h:1108
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:540
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:692
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_GetVersion(uint32_t *majorVersion, uint32_t *minorVersion, uint32_t *patchVersion, uint32_t *_)
Query the library version.
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_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:1407
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:805
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:380
peak_afl_controller_status
Controller operational status.
Definition peak_afl.h:586
@ PEAK_AFL_STATUS_SUCCESS
Operation completed successfully.
Definition peak_afl.h:386
@ PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT
Invalid or unsupported image format.
Definition peak_afl.h:454
@ PEAK_AFL_STATUS_VALUE_ADJUSTED
Parameter value was adjusted.
Definition peak_afl.h:472
@ PEAK_AFL_STATUS_ACCESS_DENIED
Access denied to resource.
Definition peak_afl.h:424
@ PEAK_AFL_STATUS_BUSY
Resource is busy.
Definition peak_afl.h:434
@ PEAK_AFL_STATUS_NOT_SUPPORTED
Feature or operation not supported.
Definition peak_afl.h:462
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:416
@ PEAK_AFL_STATUS_BUFFER_TOO_SMALL
Provided buffer is too small.
Definition peak_afl.h:444
@ PEAK_AFL_STATUS_NOT_INITIALIZED
Library not initialized.
Definition peak_afl.h:406
@ PEAK_AFL_STATUS_ERROR
General error occurred.
Definition peak_afl.h:396
#define PEAK_AFL_FALSE
Boolean false value.
Definition peak_afl.h:1643
uint8_t peak_afl_BOOL8
Custom 8-bit boolean type.
Definition peak_afl.h:1625
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:917
std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:2222
void Exit()
Exit the peak_afl auto feature library.
Definition peak_afl.hpp:2198
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:2188
Version_t Version()
Query the library version.
Definition peak_afl.hpp:2207
C API interface for automatic camera feature control.
void * peak_afl_controller_handle
Opaque handle for auto feature controllers.
Definition peak_afl.h:354
void * peak_afl_manager_handle
Opaque handle for auto feature managers.
Definition peak_afl.h:366
Generic arithmetic range with inclusive endpoints and a defined step size.
Definition peak_afl.hpp:942
Version information for ids_peak_afl.
Definition peak_afl.hpp:130
std::string ToString() const
The String representation for the ids_peak_afl version.
Definition peak_afl.hpp:179
PEAK_COMMON_END_DISABLE_DEPRECATED_WARNINGS std::uint32_t major
Definition peak_afl.hpp:155
std::uint32_t Patch() const
Returns the patch part of the version which is the third part of the version scheme separated by dots...
Definition peak_afl.hpp:220
std::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:189
std::uint32_t minor
Definition peak_afl.hpp:161
std::uint32_t subminor
Definition peak_afl.hpp:167
std::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:199
std::uint32_t Subminor() const
Definition peak_afl.hpp:208
std::uint32_t patch
Definition peak_afl.hpp:173
Controller parameter limit range.
Definition peak_afl.h:1566
Floating-point parameter limit range.
Definition peak_afl.h:1596
Generic process data structure.
Definition peak_afl.h:1126
2D rectangle structure
Definition peak_afl.h:1494
2D size structure
Definition peak_afl.h:1432
Weighted region of interest for focus control.
Definition peak_afl.h:1536