IDS peak AFL v2.0.0
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
792 inline void SetCCM(std::array<float, 9> ccm);
793
805 PEAK_AFL_NO_DISCARD inline bool Status() const;
806
814 PEAK_AFL_NO_DISCARD inline std::vector<std::shared_ptr<Controller>> ControllerList() const;
815
823 PEAK_AFL_NO_DISCARD inline size_t ControllerCount() const;
824
836 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> GetController(peak_afl_controllerType type) const;
837
847 PEAK_AFL_NO_DISCARD inline bool IsControllerSupported(peak_afl_controllerType type) const;
848
849private:
850 std::vector<std::shared_ptr<Controller>> m_controllerList;
851 mutable std::mutex m_mutex{};
852 peak_afl_manager_handle m_handle{};
853};
854
864template <typename... ControllerTypes>
865std::tuple<Manager, std::vector<std::shared_ptr<Controller>>> CreateManager(
866 const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
867{
868 constexpr int size = sizeof...(types);
869 constexpr std::array<peak_afl_controllerType, size> controller_types{ types... };
870 std::vector<std::shared_ptr<Controller>> controller{};
871 Manager manager{ node_map };
872 controller.reserve(size);
873
874 std::for_each(controller_types.cbegin(), controller_types.cend(),
875 [&manager, &controller](peak_afl_controllerType type) { controller.emplace_back(manager.CreateController(type)); });
876
877 return { std::move(manager), std::move(controller) };
878}
879
880
888template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
889struct Range
890{
891 T min;
892 T max;
893 T inc;
894};
895
896namespace callback
897{
898using FinishedCallback = std::function<void(void)>;
899using DataProcessingCallback = std::function<void(int, int)>;
900using ProcessingCallback = std::function<void(peak_afl_process_data*)>;
901using ComponentCallback = std::function<void(void)>;
902
903using RegisterFunction = std::function<PEAK_AFL_API_STATUS(void*, void*)>;
904using UnRegisterFunction = std::function<void()>;
905} // namespace callback
906
983class Controller : public std::enable_shared_from_this<Controller>
984{
985 friend class Manager;
986
987 template <class T>
988 class Callback
989 {
990#ifndef SWIG
991 public:
992 template <typename R, typename... Args>
993 Callback(const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
994 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback)
995 : m_unregister_function(std::move(unregister_function))
996 , m_callback(std::move(callback))
997 {
998 const auto ret = register_function(reinterpret_cast<void*>(&Callback::Func<Args...>), this);
999 if (ret != PEAK_AFL_STATUS_SUCCESS)
1000 {
1001 error::ThrowException(ret);
1002 }
1003 m_controller = controller;
1004 }
1005
1006 virtual ~Callback()
1007 {
1008 if (auto controller = m_controller.lock())
1009 {
1010 m_unregister_function();
1011 }
1012 }
1013
1014 private:
1015 template <typename... Args>
1016 static void Func(Args... args, void* ptr)
1017 {
1018 static_cast<Callback*>(ptr)->m_callback(args...);
1019 };
1020#endif
1021
1022 std::weak_ptr<peak::afl::Controller> m_controller{};
1023 callback::UnRegisterFunction m_unregister_function{};
1024 T m_callback{};
1025 };
1026
1027
1037 inline explicit Controller(peak_afl_controller_handle handle)
1038 : m_handle(handle) {};
1039
1040public:
1044 inline ~Controller();
1045
1046 Controller(const Controller&) = delete;
1047 Controller(Controller&&) = delete;
1048 Controller& operator=(const Controller&) = delete;
1049 Controller& operator=(Controller&&) = delete;
1050
1062 PEAK_AFL_NO_DISCARD inline static std::shared_ptr<Controller> Create(peak_afl_controllerType type);
1063
1073 PEAK_AFL_NO_DISCARD inline bool IsSkipFramesSupported() const;
1074
1086 inline void SetSkipFrames(std::uint32_t count);
1087
1099 PEAK_AFL_NO_DISCARD inline std::uint32_t GetSkipFrames() const;
1100
1110 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetSkipFramesRange() const;
1111
1123 PEAK_AFL_NO_DISCARD inline bool IsROISupported() const;
1124
1136 inline void SetROI(peak_afl_rectangle rect);
1137
1149 PEAK_AFL_NO_DISCARD inline peak_afl_rectangle GetROI() const;
1150
1162 PEAK_AFL_NO_DISCARD inline bool IsROIPresetSupported() const;
1163
1175 inline void SetROIPreset(peak_afl_roi_preset preset);
1176
1188 PEAK_AFL_NO_DISCARD inline bool IsModeSupported() const;
1189
1201 inline void SetMode(peak_afl_controller_automode mode);
1202
1212 PEAK_AFL_NO_DISCARD inline peak_afl_controller_automode GetMode() const;
1213
1225 PEAK_AFL_NO_DISCARD bool IsBrightnessAlgorithmSupported() const;
1226
1240
1249
1261 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status Status() const;
1262
1274 PEAK_AFL_NO_DISCARD inline std::uint8_t GetLastAutoAverage() const;
1275
1287 PEAK_AFL_NO_DISCARD inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> GetLastAutoAverages() const;
1288
1300 PEAK_AFL_NO_DISCARD inline bool IsAutoTargetSupported() const;
1301
1314 inline void SetAutoTarget(uint32_t target);
1315
1325 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTarget() const;
1326
1339 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoTargetRange() const;
1340
1352 PEAK_AFL_NO_DISCARD inline bool IsAutoToleranceSupported() const;
1353
1365 inline void SetAutoTolerance(std::uint32_t tolerance);
1366
1376 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTolerance() const;
1377
1390 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoToleranceRange() const;
1391
1403 PEAK_AFL_NO_DISCARD inline bool IsAutoPercentileSupported() const;
1404
1417 inline void SetAutoPercentile(double percentile);
1418
1428 PEAK_AFL_NO_DISCARD inline double GetAutoPercentile() const;
1429
1442 PEAK_AFL_NO_DISCARD inline Range<double> GetAutoPercentileRange() const;
1443
1455 PEAK_AFL_NO_DISCARD inline peak_afl_controllerType Type() const;
1456
1470 PEAK_AFL_NO_DISCARD inline bool IsAlgorithmSupported() const;
1471
1483 inline void SetAlgorithm(peak_afl_controller_algorithm algorithm);
1484
1492 PEAK_AFL_NO_DISCARD inline peak_afl_controller_algorithm GetAlgorithm() const;
1493
1505 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_algorithm> GetAlgorithmList() const;
1506
1518 PEAK_AFL_NO_DISCARD inline bool IsSharpnessAlgorithmSupported() const;
1519
1532
1542 PEAK_AFL_NO_DISCARD inline peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const;
1543
1555 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_sharpness_algorithm> GetSharpnessAlgorithmList() const;
1556
1566 inline void RegisterFinishedCallback(const callback::FinishedCallback& callback);
1567
1575 inline void UnRegisterFinishedCallback();
1576
1585 inline void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback);
1586
1597
1607 PEAK_AFL_DEPRECATED_ATTR inline void RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback);
1608
1616 PEAK_AFL_DEPRECATED_ATTR inline void UnRegisterDataProcessingCallback();
1617
1625 inline void RegisterProcessingCallback(const callback::ProcessingCallback& callback);
1626
1634 inline void UnRegisterProcessingCallback();
1635
1647 PEAK_AFL_NO_DISCARD inline bool IsWeightedROISupported() const;
1648
1660 inline void SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list);
1661
1673 inline void SetWeightedROI(const peak_afl_weighted_rectangle& rect);
1674
1684 PEAK_AFL_NO_DISCARD inline peak_afl_size GetWeightedROIMinSize() const;
1685
1695 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_weighted_rectangle> GetWeightedROIs() const;
1696
1708 PEAK_AFL_NO_DISCARD inline bool IsLimitSupported() const;
1709
1721 inline void SetLimit(peak_afl_controller_limit limit);
1722
1732 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetLimit() const;
1733
1743 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetDefaultLimit() const;
1744
1756 PEAK_AFL_NO_DISCARD inline bool IsHysteresisSupported() const;
1757
1769 inline void SetHysteresis(std::uint8_t hysteresis);
1770
1780 PEAK_AFL_NO_DISCARD inline std::uint8_t GetHysteresis() const;
1781
1791 PEAK_AFL_NO_DISCARD inline std::uint8_t GetDefaultHysteresis() const;
1792
1802 PEAK_AFL_NO_DISCARD inline Range<std::uint8_t> GetHysteresisRange() const;
1803
1815 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentModeSupported() const;
1816
1829 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentUnitSupported(peak_afl_controller_brightness_component component) const;
1830
1844
1857
1870 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status BrightnessComponentStatus(
1872
1882 PEAK_AFL_NO_DISCARD inline bool IsGainLimitSupported() const;
1883
1900 inline void SetGainLimit(peak_afl_double_limit limit);
1901
1911 inline peak_afl_double_limit GetGainLimit() const;
1912
1923
1939 inline void SetGainAnalogLimit(peak_afl_double_limit limit);
1940
1951
1962
1978 inline void SetGainDigitalLimit(peak_afl_double_limit limit);
1979
1990
2001
2018
2029
2040
2056 inline void SetGainHostLimit(peak_afl_double_limit limit);
2057
2068
2079
2089 inline void SetExposureLimit(peak_afl_double_limit limit);
2090
2101
2112
2113
2114private:
2115 using FinishedCallbackType = Callback<callback::FinishedCallback>;
2116 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
2117 using ProcessingCallbackType = Callback<callback::ProcessingCallback>;
2118 using ComponentCallbackType = Callback<callback::ComponentCallback>;
2119
2120 peak_afl_controller_handle m_handle{};
2121 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
2122 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
2123 std::unique_ptr<ProcessingCallbackType> m_ProcessingCallback{};
2124 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
2125
2126 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
2127
2128 std::unique_ptr<ComponentCallbackType> m_AnalogGainCallback{};
2129 std::unique_ptr<ComponentCallbackType> m_DigitalGainCallback{};
2130 std::unique_ptr<ComponentCallbackType> m_CombinedGainCallback{};
2131 std::unique_ptr<ComponentCallbackType> m_HostGainCallback{};
2132};
2133
2134namespace library
2135{
2136inline void Init()
2137{
2138 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Init();
2139 if (ret != PEAK_AFL_STATUS_SUCCESS)
2140
2141 {
2142 error::ThrowException(ret, false);
2143 }
2144}
2145
2146inline void Exit()
2147{
2148 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Exit();
2149 if (ret != PEAK_AFL_STATUS_SUCCESS)
2150 {
2151 error::ThrowException(ret, false);
2152 }
2153}
2154
2156{
2157 Version_t version{};
2158
2159 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetVersion(&version.major, &version.minor, &version.subminor, &version.patch);
2160 if (ret != PEAK_AFL_STATUS_SUCCESS)
2161 {
2162 error::ThrowException(ret, false);
2163 }
2164
2165 return version;
2166}
2167
2168inline std::string GetLastError()
2169{
2170 std::size_t lastErrorMessageSize;
2171 peak_afl_status code;
2172
2173 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, nullptr, &lastErrorMessageSize);
2174 if (ret != PEAK_AFL_STATUS_SUCCESS)
2175 {
2176 return "Cannot get last error!";
2177 }
2178
2179 std::vector<char> text;
2180 text.resize(lastErrorMessageSize);
2181
2182 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, text.data(), &lastErrorMessageSize);
2183 if (ret != PEAK_AFL_STATUS_SUCCESS)
2184 {
2185 return "Cannot get last error!";
2186 }
2187
2188 return { text.begin(), text.end() };
2189}
2190} // namespace library
2191
2192inline Manager::Manager(const std::shared_ptr<peak::core::NodeMap>& node_map)
2193{
2194 if (node_map == nullptr)
2195 {
2197 }
2198
2199 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Create(&m_handle, node_map->Handle());
2200 if (ret != PEAK_AFL_STATUS_SUCCESS)
2201 {
2202 error::ThrowException(ret);
2203 }
2204}
2205
2207{
2208 if (m_handle != nullptr)
2209 {
2210 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
2211
2212 {
2213 std::lock_guard<std::mutex> lck(m_mutex);
2214 for (auto& c : m_controllerList)
2215 {
2216 c->m_handle = nullptr;
2217 }
2218 }
2219
2220 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Destroy(m_handle);
2221 m_handle = nullptr;
2222 }
2223}
2224
2225inline Manager::Manager(Manager&& other) noexcept
2226{
2227 m_handle = other.m_handle;
2228 other.m_handle = nullptr;
2229
2230 std::lock_guard<std::mutex> lck(other.m_mutex);
2231 m_controllerList = std::move(other.m_controllerList);
2232}
2233
2234inline Manager& Manager::operator=(Manager&& other) noexcept
2235{
2236 m_handle = other.m_handle;
2237 other.m_handle = nullptr;
2238
2239 std::lock_guard<std::mutex> lck(other.m_mutex);
2240 m_controllerList = std::move(other.m_controllerList);
2241
2242 return *this;
2243}
2244
2245inline void Manager::AddController(const std::shared_ptr<Controller>& controller)
2246{
2247 std::lock_guard<std::mutex> lck(m_mutex);
2248
2249 auto cnt = std::any_of(
2250 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2251
2252 if (cnt)
2253 {
2254 return;
2255 }
2256
2257 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_AddController(m_handle, controller->m_handle);
2258 if (ret != PEAK_AFL_STATUS_SUCCESS)
2259 {
2260 error::ThrowException(ret);
2261 }
2262
2263 m_controllerList.emplace_back(controller);
2264}
2265
2266inline void Manager::RemoveController(const std::shared_ptr<Controller>& controller)
2267{
2268 std::lock_guard<std::mutex> lck(m_mutex);
2269
2270 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_RemoveController(m_handle, controller->m_handle);
2271 if (ret != PEAK_AFL_STATUS_SUCCESS)
2272 {
2273 error::ThrowException(ret);
2274 }
2275
2276 auto it = std::remove_if(
2277 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2278
2279 m_controllerList.erase(it, m_controllerList.end());
2280}
2281
2282inline void Manager::Process(const peak::ipl::Image& image) const
2283{
2284 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Process(m_handle, ImageBackendAccessor::BackendHandle(image));
2285 if (ret != PEAK_AFL_STATUS_SUCCESS)
2286 {
2287 error::ThrowException(ret);
2288 }
2289}
2290
2291inline std::shared_ptr<Controller> Manager::CreateController(peak_afl_controllerType type)
2292{
2293 std::lock_guard<std::mutex> lck(m_mutex);
2294
2296 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_CreateController(m_handle, &handle, type);
2297 if (ret != PEAK_AFL_STATUS_SUCCESS)
2298 {
2299 error::ThrowException(ret);
2300 }
2301
2302 auto shared = std::shared_ptr<Controller>(new Controller(handle));
2303 m_controllerList.emplace_back(shared);
2304
2305 return shared;
2306}
2307
2309{
2310 std::lock_guard<std::mutex> lck(m_mutex);
2311
2312 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
2313 if (ret != PEAK_AFL_STATUS_SUCCESS)
2314 {
2315 error::ThrowException(ret);
2316 }
2317
2318 for (auto& c : m_controllerList)
2319 {
2320 c->m_handle = nullptr;
2321 }
2322
2323 m_controllerList.clear();
2324}
2325
2326inline void Manager::DestroyController(const std::shared_ptr<Controller>& controller)
2327{
2328 std::lock_guard<std::mutex> lck(m_mutex);
2329
2330 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyController(m_handle, controller->m_handle);
2331 if (ret != PEAK_AFL_STATUS_SUCCESS)
2332 {
2333 error::ThrowException(ret);
2334 }
2335
2336 auto it = std::remove_if(
2337 m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) { return c == controller; });
2338
2339 m_controllerList.erase(it, m_controllerList.end());
2340
2341 controller->m_handle = nullptr;
2342}
2343
2344inline void Manager::SetGainIPL(const peak::ipl::Gain& gain)
2345{
2346 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetGainIPL(m_handle, GainBackendAccessor::BackendHandle(gain));
2347 if (ret != PEAK_AFL_STATUS_SUCCESS)
2348 {
2349 error::ThrowException(ret);
2350 }
2351}
2352
2353inline void Manager::SetCCM(std::array<float, 9> ccm)
2354{
2355 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetCCM(m_handle, ccm.data(), ccm.size());
2356 if (ret != PEAK_AFL_STATUS_SUCCESS)
2357 {
2358 error::ThrowException(ret);
2359 }
2360}
2361
2362inline bool Manager::Status() const
2363{
2364 std::uint8_t status;
2365 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Status(m_handle, &status);
2366 if (ret != PEAK_AFL_STATUS_SUCCESS)
2367 {
2368 error::ThrowException(ret);
2369 }
2370
2371 return status;
2372}
2373
2374inline std::vector<std::shared_ptr<Controller>> Manager::ControllerList() const
2375{
2376 std::lock_guard<std::mutex> lck(m_mutex);
2377
2378 std::vector<std::shared_ptr<Controller>> controller{};
2379
2380 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
2381
2382 return controller;
2383}
2384
2385inline size_t Manager::ControllerCount() const
2386{
2387 return m_controllerList.size();
2388}
2389
2390inline std::shared_ptr<Controller> Manager::GetController(peak_afl_controllerType type) const
2391{
2392 std::lock_guard<std::mutex> lck(m_mutex);
2393
2394 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(),
2395 [=](const std::shared_ptr<Controller>& controller) { return type == controller->Type(); });
2396
2397 if (it != m_controllerList.cend())
2398 {
2399 return *it;
2400 }
2401 else
2402 {
2403 throw error::InternalErrorException("No controller found!", PEAK_AFL_STATUS_ERROR);
2404 }
2405}
2406
2408{
2409 peak_afl_BOOL8 supported{};
2410 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Controller_IsSupported(m_handle, type, &supported);
2411 if (ret != PEAK_AFL_STATUS_SUCCESS)
2412 {
2413 error::ThrowException(ret);
2414 }
2415
2416 return supported != PEAK_AFL_FALSE;
2417}
2418
2419
2420inline std::shared_ptr<Controller> Controller::Create(peak_afl_controllerType type)
2421{
2423 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Create(&handle, type);
2424 if (ret != PEAK_AFL_STATUS_SUCCESS)
2425 {
2426 error::ThrowException(ret);
2427 }
2428
2429 return std::shared_ptr<Controller>(new Controller(handle));
2430}
2431
2433{
2434 if (m_handle != nullptr)
2435 {
2436 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Destroy(m_handle);
2437 m_handle = nullptr;
2438 }
2439}
2440
2442{
2443 peak_afl_BOOL8 supported{};
2444 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_IsSupported(m_handle, &supported);
2445 if (ret != PEAK_AFL_STATUS_SUCCESS)
2446 {
2447 error::ThrowException(ret);
2448 }
2449
2450 return supported;
2451}
2452
2453inline void Controller::SetSkipFrames(std::uint32_t count)
2454{
2455 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Set(m_handle, count);
2456 if (ret != PEAK_AFL_STATUS_SUCCESS)
2457 {
2458 error::ThrowException(ret);
2459 }
2460}
2461
2462inline std::uint32_t Controller::GetSkipFrames() const
2463{
2464 std::uint32_t count{};
2465 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Get(m_handle, &count);
2466 if (ret != PEAK_AFL_STATUS_SUCCESS)
2467 {
2468 error::ThrowException(ret);
2469 }
2470
2471 return count;
2472}
2473
2475{
2476 Range<std::uint32_t> range{};
2477 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_GetRange(m_handle, &range.min, &range.max, &range.inc);
2478 if (ret != PEAK_AFL_STATUS_SUCCESS)
2479 {
2480 error::ThrowException(ret);
2481 }
2482
2483 return range;
2484}
2485
2487{
2488 peak_afl_BOOL8 supported{};
2489 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_IsSupported(m_handle, &supported);
2490 if (ret != PEAK_AFL_STATUS_SUCCESS)
2491 {
2492 error::ThrowException(ret);
2493 }
2494
2495 return supported;
2496}
2497
2499{
2500 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Set(m_handle, rect);
2501 if (ret != PEAK_AFL_STATUS_SUCCESS)
2502 {
2503 error::ThrowException(ret);
2504 }
2505}
2506
2508{
2509 peak_afl_rectangle rect{};
2510 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Get(m_handle, &rect);
2511 if (ret != PEAK_AFL_STATUS_SUCCESS)
2512 {
2513 error::ThrowException(ret);
2514 }
2515 return rect;
2516}
2517
2519{
2520 peak_afl_BOOL8 supported{};
2521 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_IsSupported(m_handle, &supported);
2522 if (ret != PEAK_AFL_STATUS_SUCCESS)
2523 {
2524 error::ThrowException(ret);
2525 }
2526
2527 return supported;
2528}
2529
2531{
2532 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_Set(m_handle, preset);
2533 if (ret != PEAK_AFL_STATUS_SUCCESS)
2534 {
2535 error::ThrowException(ret);
2536 }
2537}
2538
2540{
2541 peak_afl_BOOL8 supported{};
2542 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_IsSupported(m_handle, &supported);
2543 if (ret != PEAK_AFL_STATUS_SUCCESS)
2544 {
2545 error::ThrowException(ret);
2546 }
2547
2548 return supported;
2549}
2550
2552{
2553 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Set(m_handle, mode);
2554 if (ret != PEAK_AFL_STATUS_SUCCESS)
2555 {
2556 error::ThrowException(ret);
2557 }
2558}
2559
2561{
2563 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Get(m_handle, &mode);
2564 if (ret != PEAK_AFL_STATUS_SUCCESS)
2565 {
2566 error::ThrowException(ret);
2567 }
2568 return mode;
2569}
2570
2572{
2573 peak_afl_BOOL8 supported{};
2574 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_IsSupported(m_handle, &supported);
2575 if (ret != PEAK_AFL_STATUS_SUCCESS)
2576 {
2577 error::ThrowException(ret);
2578 }
2579
2580 return supported;
2581}
2582
2584{
2585 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Set(m_handle, algorithm);
2586 if (ret != PEAK_AFL_STATUS_SUCCESS)
2587 {
2588 error::ThrowException(ret);
2589 }
2590}
2591
2593{
2595 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Get(m_handle, &algorithm);
2596 if (ret != PEAK_AFL_STATUS_SUCCESS)
2597 {
2598 error::ThrowException(ret);
2599 }
2600 return algorithm;
2601}
2602
2604{
2606 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Status(m_handle, &status);
2607 if (ret != PEAK_AFL_STATUS_SUCCESS)
2608 {
2609 error::ThrowException(ret);
2610 }
2611 return status;
2612}
2613
2614
2615inline std::uint8_t Controller::GetLastAutoAverage() const
2616{
2617 std::uint8_t average{};
2618 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverage(m_handle, &average);
2619 if (ret != PEAK_AFL_STATUS_SUCCESS)
2620 {
2621 error::ThrowException(ret);
2622 }
2623 return average;
2624}
2625
2626inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> Controller::GetLastAutoAverages() const
2627{
2628 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
2629 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverages(m_handle, &averageRed, &averageGreen, &averageBlue);
2630 if (ret != PEAK_AFL_STATUS_SUCCESS)
2631 {
2632 error::ThrowException(ret);
2633 }
2634 return { averageRed, averageGreen, averageBlue };
2635}
2636
2638{
2639 peak_afl_BOOL8 supported{};
2640 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_IsSupported(m_handle, &supported);
2641 if (ret != PEAK_AFL_STATUS_SUCCESS)
2642 {
2643 error::ThrowException(ret);
2644 }
2645
2646 return supported;
2647}
2648
2649inline void Controller::SetAutoTarget(std::uint32_t target)
2650{
2651 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Set(m_handle, target);
2652 if (ret != PEAK_AFL_STATUS_SUCCESS)
2653 {
2654 error::ThrowException(ret);
2655 }
2656}
2657
2658inline std::uint32_t Controller::GetAutoTarget() const
2659{
2660 std::uint32_t target{};
2661 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Get(m_handle, &target);
2662 if (ret != PEAK_AFL_STATUS_SUCCESS)
2663 {
2664 error::ThrowException(ret);
2665 }
2666 return target;
2667}
2668
2670{
2671 Range<std::uint32_t> range{};
2672 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_GetRange(m_handle, &range.min, &range.max, &range.inc);
2673 if (ret != PEAK_AFL_STATUS_SUCCESS)
2674 {
2675 error::ThrowException(ret);
2676 }
2677 return range;
2678}
2679
2681{
2682 peak_afl_BOOL8 supported{};
2683 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_IsSupported(m_handle, &supported);
2684 if (ret != PEAK_AFL_STATUS_SUCCESS)
2685 {
2686 error::ThrowException(ret);
2687 }
2688
2689 return supported;
2690}
2691
2692inline void Controller::SetAutoTolerance(uint32_t tolerance)
2693{
2694 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Set(m_handle, tolerance);
2695 if (ret != PEAK_AFL_STATUS_SUCCESS)
2696 {
2697 error::ThrowException(ret);
2698 }
2699}
2700
2701inline uint32_t Controller::GetAutoTolerance() const
2702{
2703 std::uint32_t tolerance;
2704 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Get(m_handle, &tolerance);
2705 if (ret != PEAK_AFL_STATUS_SUCCESS)
2706 {
2707 error::ThrowException(ret);
2708 }
2709 return tolerance;
2710}
2711
2713{
2714 Range<uint32_t> range{};
2715 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_GetRange(m_handle, &range.min, &range.max, &range.inc);
2716 if (ret != PEAK_AFL_STATUS_SUCCESS)
2717 {
2718 error::ThrowException(ret);
2719 }
2720 return range;
2721}
2722
2724{
2725 peak_afl_BOOL8 supported{};
2726 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_IsSupported(m_handle, &supported);
2727 if (ret != PEAK_AFL_STATUS_SUCCESS)
2728 {
2729 error::ThrowException(ret);
2730 }
2731
2732 return supported;
2733}
2734
2735inline void Controller::SetAutoPercentile(double percentile)
2736{
2737 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Set(m_handle, percentile);
2738 if (ret != PEAK_AFL_STATUS_SUCCESS)
2739 {
2740 error::ThrowException(ret);
2741 }
2742}
2743
2745{
2746 double percentile;
2747 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Get(m_handle, &percentile);
2748 if (ret != PEAK_AFL_STATUS_SUCCESS)
2749 {
2750 error::ThrowException(ret);
2751 }
2752 return percentile;
2753}
2754
2756{
2757 Range<double> range{};
2758 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_GetRange(m_handle, &range.min, &range.max, &range.inc);
2759 if (ret != PEAK_AFL_STATUS_SUCCESS)
2760 {
2761 error::ThrowException(ret);
2762 }
2763 return range;
2764}
2765
2767{
2769 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Type_Get(m_handle, &type);
2770 if (ret != PEAK_AFL_STATUS_SUCCESS)
2771 {
2772 error::ThrowException(ret);
2773 }
2774 return type;
2775}
2776
2778{
2779 peak_afl_BOOL8 supported{};
2780 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_IsSupported(m_handle, &supported);
2781 if (ret != PEAK_AFL_STATUS_SUCCESS)
2782 {
2783 error::ThrowException(ret);
2784 }
2785
2786 return supported;
2787}
2788
2790{
2791 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Set(m_handle, alg);
2792 if (ret != PEAK_AFL_STATUS_SUCCESS)
2793 {
2794 error::ThrowException(ret);
2795 }
2796}
2797
2799{
2801 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Get(m_handle, &alg);
2802 if (ret != PEAK_AFL_STATUS_SUCCESS)
2803 {
2804 error::ThrowException(ret);
2805 }
2806
2807 return alg;
2808}
2809
2810inline std::vector<peak_afl_controller_algorithm> Controller::GetAlgorithmList() const
2811{
2812 std::vector<peak_afl_controller_algorithm> algList{};
2813 std::uint32_t listSize{};
2814
2815 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, nullptr, &listSize);
2816 if (ret != PEAK_AFL_STATUS_SUCCESS)
2817 {
2818 error::ThrowException(ret);
2819 }
2820
2821 algList.resize(listSize);
2822
2823 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, algList.data(), &listSize);
2824 if (ret != PEAK_AFL_STATUS_SUCCESS)
2825 {
2826 error::ThrowException(ret);
2827 }
2828
2829 return algList;
2830}
2831
2833{
2834 peak_afl_BOOL8 supported{};
2835 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_IsSupported(m_handle, &supported);
2836 if (ret != PEAK_AFL_STATUS_SUCCESS)
2837 {
2838 error::ThrowException(ret);
2839 }
2840
2841 return supported;
2842}
2843
2845{
2846 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Set(m_handle, alg);
2847 if (ret != PEAK_AFL_STATUS_SUCCESS)
2848 {
2849 error::ThrowException(ret);
2850 }
2851}
2852
2854{
2856 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Get(m_handle, &alg);
2857 if (ret != PEAK_AFL_STATUS_SUCCESS)
2858 {
2859 error::ThrowException(ret);
2860 }
2861
2862 return alg;
2863}
2864
2865inline std::vector<peak_afl_controller_sharpness_algorithm> Controller::GetSharpnessAlgorithmList() const
2866{
2867 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
2868 std::uint32_t listSize{};
2869
2870 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, nullptr, &listSize);
2871 if (ret != PEAK_AFL_STATUS_SUCCESS)
2872 {
2873 error::ThrowException(ret);
2874 }
2875
2876 algList.resize(listSize);
2877
2878 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, algList.data(), &listSize);
2879 if (ret != PEAK_AFL_STATUS_SUCCESS)
2880 {
2881 error::ThrowException(ret);
2882 }
2883
2884 return algList;
2885}
2886
2887inline void Controller::RegisterFinishedCallback(const callback::FinishedCallback& callback)
2888{
2889 m_finishedCallback = std::make_unique<FinishedCallbackType>(
2890 shared_from_this(),
2891 [handle = m_handle](void* ptr, void* ctx) {
2892 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx);
2893 },
2894 [handle = m_handle] {
2895 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
2896 handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr);
2897 },
2898 callback);
2899}
2900
2902{
2903 m_finishedCallback.reset();
2904}
2905
2907 peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback)
2908{
2910 {
2911 throw error::NotSupportedException("Brightness component not supported!", PEAK_AFL_STATUS_NOT_SUPPORTED);
2912 }
2913
2914 const auto registerCallback = [&](peak_afl_controller_brightness_component component) {
2915 return std::make_unique<ComponentCallbackType>(
2916 shared_from_this(),
2917 [handle = m_handle, component](void* ptr, void* ctx) {
2919 handle, component, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx);
2920 },
2921 [handle = m_handle, component] {
2923 handle, component, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr);
2924 },
2925 callback);
2926 };
2927
2928 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
2930 {
2931 m_finishedExposureCallback = registerCallback(component);
2932 }
2934 {
2935 m_finishedGainCallback = registerCallback(component);
2936 }
2938 {
2939 m_AnalogGainCallback = registerCallback(component);
2940 }
2942 {
2943 m_DigitalGainCallback = registerCallback(component);
2944 }
2946 {
2947 m_CombinedGainCallback = registerCallback(component);
2948 }
2950 {
2951 m_HostGainCallback = registerCallback(component);
2952 }
2953 else
2954 {
2955 throw error::InvalidParameterException("Brightness component type is invalid!", PEAK_AFL_STATUS_INVALID_PARAMETER);
2956 }
2957 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
2958}
2959
2961{
2962 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
2964 {
2965 m_finishedExposureCallback.reset();
2966 }
2968 {
2969 m_finishedGainCallback.reset();
2970 }
2972 {
2973 m_AnalogGainCallback.reset();
2974 }
2976 {
2977 m_DigitalGainCallback.reset();
2978 }
2980 {
2981 m_CombinedGainCallback.reset();
2982 }
2984 {
2985 m_HostGainCallback.reset();
2986 }
2987 else
2988 {
2989 throw error::InvalidParameterException("Brightness component type is invalid!", PEAK_AFL_STATUS_INVALID_PARAMETER);
2990 }
2991 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
2992}
2993
2994inline void Controller::RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback)
2995{
2996 PEAK_AFL_BEGIN_DISABLE_DEPRECATED_WARNINGS
2997 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(
2998 shared_from_this(),
2999 [handle = m_handle](void* ptr, void* ctx) {
3000 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3002 },
3003 [handle = m_handle] {
3004 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3005 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, nullptr, nullptr);
3006 },
3007 callback);
3008 PEAK_AFL_END_DISABLE_DEPRECATED_WARNINGS
3009}
3010
3011inline void Controller::RegisterProcessingCallback(const callback::ProcessingCallback& callback)
3012{
3013 m_ProcessingCallback = std::make_unique<ProcessingCallbackType>(
3014 shared_from_this(),
3015 [handle = m_handle](void* ptr, void* ctx) {
3016 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3017 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING, ptr, ctx);
3018 },
3019 [handle = m_handle] {
3020 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(
3021 handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING, nullptr, nullptr);
3022 },
3023 callback);
3024}
3025
3027{
3028 m_ProcessingCallback.reset();
3029}
3030
3032{
3033 m_dataProcessingCallback.reset();
3034}
3035
3037{
3038 peak_afl_BOOL8 supported{};
3039 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_IsSupported(m_handle, &supported);
3040 if (ret != PEAK_AFL_STATUS_SUCCESS)
3041 {
3042 error::ThrowException(ret);
3043 }
3044
3045 return supported;
3046}
3047
3048inline void Controller::SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list)
3049{
3050 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(
3051 m_handle, list.data(), static_cast<uint32_t>(list.size()));
3052 if (ret != PEAK_AFL_STATUS_SUCCESS)
3053 {
3054 error::ThrowException(ret);
3055 }
3056}
3057
3059{
3060 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, &rect, 1);
3061 if (ret != PEAK_AFL_STATUS_SUCCESS)
3062 {
3063 error::ThrowException(ret);
3064 }
3065}
3066
3068{
3069 peak_afl_size minSize{};
3070 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Min_Size(m_handle, &minSize);
3071 if (ret != PEAK_AFL_STATUS_SUCCESS)
3072 {
3073 error::ThrowException(ret);
3074 }
3075 return minSize;
3076}
3077
3078inline std::vector<peak_afl_weighted_rectangle> Controller::GetWeightedROIs() const
3079{
3080 std::vector<peak_afl_weighted_rectangle> list;
3081 std::uint32_t listSize{};
3082
3083 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, nullptr, &listSize);
3084 if (ret != PEAK_AFL_STATUS_SUCCESS)
3085 {
3086 error::ThrowException(ret);
3087 }
3088
3089 list.resize(listSize);
3090
3091 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, list.data(), &listSize);
3092 if (ret != PEAK_AFL_STATUS_SUCCESS)
3093 {
3094 error::ThrowException(ret);
3095 }
3096
3097 return list;
3098}
3099
3101{
3102 peak_afl_BOOL8 supported{};
3103 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_IsSupported(m_handle, &supported);
3104 if (ret != PEAK_AFL_STATUS_SUCCESS)
3105 {
3106 error::ThrowException(ret);
3107 }
3108
3109 return supported;
3110}
3111
3113{
3114 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Set(m_handle, limit);
3115 if (ret != PEAK_AFL_STATUS_SUCCESS)
3116 {
3117 error::ThrowException(ret);
3118 }
3119}
3120
3122{
3124 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Get(m_handle, &limit);
3125 if (ret != PEAK_AFL_STATUS_SUCCESS)
3126 {
3127 error::ThrowException(ret);
3128 }
3129 return limit;
3130}
3131
3133{
3135 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Default(m_handle, &limit);
3136 if (ret != PEAK_AFL_STATUS_SUCCESS)
3137 {
3138 error::ThrowException(ret);
3139 }
3140 return limit;
3141}
3142
3144{
3145 peak_afl_BOOL8 supported{};
3146 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_IsSupported(m_handle, &supported);
3147 if (ret != PEAK_AFL_STATUS_SUCCESS)
3148 {
3149 error::ThrowException(ret);
3150 }
3151
3152 return supported;
3153}
3154
3155inline void Controller::SetHysteresis(std::uint8_t hysteresis)
3156{
3157 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Set(m_handle, hysteresis);
3158 if (ret != PEAK_AFL_STATUS_SUCCESS)
3159 {
3160 error::ThrowException(ret);
3161 }
3162}
3163
3164inline std::uint8_t Controller::GetHysteresis() const
3165{
3166 std::uint8_t hysteresis{};
3167 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Get(m_handle, &hysteresis);
3168 if (ret != PEAK_AFL_STATUS_SUCCESS)
3169 {
3170 error::ThrowException(ret);
3171 }
3172
3173 return hysteresis;
3174}
3175
3176inline std::uint8_t Controller::GetDefaultHysteresis() const
3177{
3178 std::uint8_t hysteresis{};
3179 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Default(m_handle, &hysteresis);
3180 if (ret != PEAK_AFL_STATUS_SUCCESS)
3181 {
3182 error::ThrowException(ret);
3183 }
3184
3185 return hysteresis;
3186}
3187
3189{
3190 Range<std::uint8_t> hysteresis{};
3191 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_GetRange(
3192 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
3193 if (ret != PEAK_AFL_STATUS_SUCCESS)
3194 {
3195 error::ThrowException(ret);
3196 }
3197
3198 return hysteresis;
3199}
3200
3201PEAK_AFL_NO_DISCARD inline bool Controller::IsBrightnessComponentModeSupported() const
3202{
3203 peak_afl_BOOL8 supported{};
3204 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(m_handle, &supported);
3205 if (ret != PEAK_AFL_STATUS_SUCCESS)
3206 {
3207 error::ThrowException(ret);
3208 }
3209
3210 return supported;
3211}
3212
3215{
3216 peak_afl_BOOL8 supported{};
3217 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Unit_IsSupported(m_handle, component, &supported);
3218 if (ret != PEAK_AFL_STATUS_SUCCESS)
3219 {
3220 error::ThrowException(ret);
3221 }
3222
3223 return supported;
3224}
3225
3228{
3229 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Set(m_handle, component, mode);
3230 if (ret != PEAK_AFL_STATUS_SUCCESS)
3231 {
3232 error::ThrowException(ret);
3233 }
3234}
3235
3238{
3240 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Get(m_handle, component, &mode);
3241 if (ret != PEAK_AFL_STATUS_SUCCESS)
3242 {
3243 error::ThrowException(ret);
3244 }
3245 return mode;
3246}
3247
3250{
3252 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Status(m_handle, component, &status);
3253 if (ret != PEAK_AFL_STATUS_SUCCESS)
3254 {
3255 error::ThrowException(ret);
3256 }
3257 return status;
3258}
3259
3261{
3262 peak_afl_BOOL8 supported{};
3263 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_IsSupported(m_handle, &supported);
3264 if (ret != PEAK_AFL_STATUS_SUCCESS)
3265 {
3266 error::ThrowException(ret);
3267 }
3268
3269 return supported;
3270}
3271
3273{
3274 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Set(m_handle, limit);
3276 {
3277 // Do nothing. Not an error.
3278 }
3279 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3280 {
3281 error::ThrowException(ret);
3282 }
3283}
3284
3286{
3287 peak_afl_double_limit limit{};
3288 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Get(m_handle, &limit);
3289 if (ret != PEAK_AFL_STATUS_SUCCESS)
3290 {
3291 error::ThrowException(ret);
3292 }
3293
3294 return limit;
3295}
3296
3298{
3299 peak_afl_double_limit limit{};
3300 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_GetRange(m_handle, &limit);
3301 if (ret != PEAK_AFL_STATUS_SUCCESS)
3302 {
3303 error::ThrowException(ret);
3304 }
3305
3306 return limit;
3307}
3308
3310{
3311 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Set(m_handle, limit);
3313 {
3314 // Do nothing. Not an error.
3315 }
3316 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3317 {
3318 error::ThrowException(ret);
3319 }
3320}
3321
3323{
3324 peak_afl_double_limit limit{};
3325 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Get(m_handle, &limit);
3326 if (ret != PEAK_AFL_STATUS_SUCCESS)
3327 {
3328 error::ThrowException(ret);
3329 }
3330
3331 return limit;
3332}
3333
3335{
3336 peak_afl_double_limit limit{};
3337 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_GetRange(m_handle, &limit);
3338 if (ret != PEAK_AFL_STATUS_SUCCESS)
3339 {
3340 error::ThrowException(ret);
3341 }
3342
3343 return limit;
3344}
3345
3347{
3348 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Set(m_handle, limit);
3350 {
3351 // Do nothing. Not an error.
3352 }
3353 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3354 {
3355 error::ThrowException(ret);
3356 }
3357}
3358
3360{
3361 peak_afl_double_limit limit{};
3362 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Get(m_handle, &limit);
3363 if (ret != PEAK_AFL_STATUS_SUCCESS)
3364 {
3365 error::ThrowException(ret);
3366 }
3367
3368 return limit;
3369}
3370
3372{
3373 peak_afl_double_limit limit{};
3374 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_GetRange(m_handle, &limit);
3375 if (ret != PEAK_AFL_STATUS_SUCCESS)
3376 {
3377 error::ThrowException(ret);
3378 }
3379
3380 return limit;
3381}
3382
3384{
3385 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Set(m_handle, limit);
3387 {
3388 // Do nothing. Not an error.
3389 }
3390 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3391 {
3392 error::ThrowException(ret);
3393 }
3394}
3395
3397{
3398 peak_afl_double_limit limit{};
3399 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Get(m_handle, &limit);
3400 if (ret != PEAK_AFL_STATUS_SUCCESS)
3401 {
3402 error::ThrowException(ret);
3403 }
3404
3405 return limit;
3406}
3407
3409{
3410 peak_afl_double_limit limit{};
3411 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_GetRange(m_handle, &limit);
3412 if (ret != PEAK_AFL_STATUS_SUCCESS)
3413 {
3414 error::ThrowException(ret);
3415 }
3416
3417 return limit;
3418}
3419
3421{
3422 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Set(m_handle, limit);
3424 {
3425 // Do nothing. Not an error.
3426 }
3427 else if (ret != PEAK_AFL_STATUS_SUCCESS)
3428 {
3429 error::ThrowException(ret);
3430 }
3431}
3432
3434{
3435 peak_afl_double_limit limit{};
3436 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Get(m_handle, &limit);
3437 if (ret != PEAK_AFL_STATUS_SUCCESS)
3438 {
3439 error::ThrowException(ret);
3440 }
3441
3442 return limit;
3443}
3444
3446{
3447 peak_afl_double_limit limit{};
3448 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_GetRange(m_handle, &limit);
3449 if (ret != PEAK_AFL_STATUS_SUCCESS)
3450 {
3451 error::ThrowException(ret);
3452 }
3453
3454 return limit;
3455}
3456
3458{
3459 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Set(m_handle, limit);
3460 if (ret != PEAK_AFL_STATUS_SUCCESS)
3461 {
3462 error::ThrowException(ret);
3463 }
3464}
3465
3467{
3468 peak_afl_double_limit limit{};
3469 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Get(m_handle, &limit);
3470 if (ret != PEAK_AFL_STATUS_SUCCESS)
3471 {
3472 error::ThrowException(ret);
3473 }
3474
3475 return limit;
3476}
3477
3479{
3480 peak_afl_double_limit limit{};
3481 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_GetRange(m_handle, &limit);
3482 if (ret != PEAK_AFL_STATUS_SUCCESS)
3483 {
3484 error::ThrowException(ret);
3485 }
3486
3487 return limit;
3488}
3489
3490} /* namespace afl */
3491} /* namespace peak */
High-level interface for automatic camera feature control, providing access to algorithms such as aut...
Definition peak_afl.hpp:984
peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:2766
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:2530
void SetBrightnessAlgorithm(peak_afl_controller_brightness_algorithm algorithm)
Set the autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:2583
bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:2723
bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:2680
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:3285
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:3272
std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:3176
std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:3164
void SetGainCombinedLimit(peak_afl_double_limit limit)
Set the combined gain limit for a controller.
Definition peak_afl.hpp:3383
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:2551
bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:2486
void SetGainHostLimit(peak_afl_double_limit limit)
Set the host gain limit for a controller.
Definition peak_afl.hpp:3420
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3048
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2901
peak_afl_double_limit GetGainDigitalLimit() const
Get autofeature digital gain limit for a controller.
Definition peak_afl.hpp:3359
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:3236
Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:2474
bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:2518
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:3226
std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:2615
peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:3121
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:3155
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:3457
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:2453
std::vector< peak_afl_controller_sharpness_algorithm > GetSharpnessAlgorithmList() const
Get the list of supported sharpness algorithms for a controller.
Definition peak_afl.hpp:2865
bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:2539
Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:2712
void SetGainAnalogLimit(peak_afl_double_limit limit)
Set the analog gain limit for a controller.
Definition peak_afl.hpp:3309
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:2735
void UnRegisterProcessingCallback()
Reset the data callback for a controller.
Definition peak_afl.hpp:3026
peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:2507
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:3466
void UnRegisterDataProcessingCallback()
Reset the data callback for a controller.
Definition peak_afl.hpp:3031
peak_afl_double_limit GetGainCombinedLimitRange() const
Get autofeature combined gain limit range for a controller.
Definition peak_afl.hpp:3408
std::vector< peak_afl_controller_algorithm > GetAlgorithmList() const
Get the list of supported algorithms for a controller.
Definition peak_afl.hpp:2810
~Controller()
Definition peak_afl.hpp:2432
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:2994
bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:2832
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:2960
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:2626
std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:2701
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:2789
peak_afl_double_limit GetGainDigitalLimitRange() const
Get autofeature digital gain limit range for a controller.
Definition peak_afl.hpp:3371
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:2498
peak_afl_double_limit GetGainAnalogLimitRange() const
Get autofeature analog gain limit range for a controller.
Definition peak_afl.hpp:3334
bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:2441
peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:3132
bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:3100
peak_afl_size GetWeightedROIMinSize() const
Get the autofeature minimum size of weighted region of interest for a controller.
Definition peak_afl.hpp:3067
peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:2560
static std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:2420
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:2887
peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:2798
bool IsBrightnessAlgorithmSupported() const
Check if auto brightness algorithm is supported for a controller.
Definition peak_afl.hpp:2571
peak_afl_double_limit GetGainCombinedLimit() const
Get autofeature combined gain limit for a controller.
Definition peak_afl.hpp:3396
bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:3260
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:3297
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3058
std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:2462
peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2853
peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:2603
void SetGainDigitalLimit(peak_afl_double_limit limit)
Set the digital gain limit for a controller.
Definition peak_afl.hpp:3346
bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:2777
Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:2755
peak_afl_double_limit GetExposureLimitRange() const
Get autofeature exposure limit range for a controller.
Definition peak_afl.hpp:3478
double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:2744
peak_afl_controller_brightness_algorithm GetBrightnessAlgorithm() const
Get the current autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:2592
peak_afl_double_limit GetGainAnalogLimit() const
Get autofeature analog gain limit for a controller.
Definition peak_afl.hpp:3322
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:2649
peak_afl_double_limit GetGainHostLimit() const
Get autofeature host gain limit for a controller.
Definition peak_afl.hpp:3433
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:2692
std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:2658
Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:2669
Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:3188
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:3112
bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:3036
bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:3143
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:2906
bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:3201
peak_afl_controller_status BrightnessComponentStatus(peak_afl_controller_brightness_component component) const
Get the status for a brightness controller component.
Definition peak_afl.hpp:3248
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2844
void RegisterProcessingCallback(const callback::ProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:3011
peak_afl_double_limit GetGainHostLimitRange() const
Get autofeature host gain limit range for a controller.
Definition peak_afl.hpp:3445
bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:2637
std::vector< peak_afl_weighted_rectangle > GetWeightedROIs() const
Get the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:3078
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:3213
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:2407
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:2192
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:2266
std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:2390
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:2308
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:2326
std::shared_ptr< Controller > CreateController(peak_afl_controllerType type)
Create a controller and append it to Manager.
Definition peak_afl.hpp:2291
void SetCCM(std::array< float, 9 > ccm)
Set the Color Correction Matrix (CCM)
Definition peak_afl.hpp:2353
size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:2385
bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:2362
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:2206
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:2344
std::vector< std::shared_ptr< Controller > > ControllerList() const
Get the list of the controller associated with the manager.
Definition peak_afl.hpp:2374
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:2245
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:2282
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:73
Thrown when a cast to an incompatible type is attempted.
Definition peak_common_exceptions.hpp:84
Thrown when a function receives an invalid parameter.
Definition peak_common_exceptions.hpp:49
Thrown when the library is used before proper initialization.
Definition peak_common_exceptions.hpp:97
Thrown when an unsupported operation or feature is used.
Definition peak_common_exceptions.hpp:149
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_SetCCM(peak_afl_manager_handle handle, float *ccm, size_t ccm_size)
Set the Color Correction Matrix (CCM) for image processing.
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_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:865
std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:2168
void Exit()
Exit the peak_afl auto feature library.
Definition peak_afl.hpp:2146
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:2136
Version_t Version()
Query the library version.
Definition peak_afl.hpp:2155
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:890
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