IDS peak AFL v1.5.0
Loading...
Searching...
No Matches
peak_afl.hpp
Go to the documentation of this file.
1
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"
21#include "peak_ipl/types/peak_ipl_image.hpp"
22#include "peak_ipl/algorithm/peak_ipl_gain.hpp"
23#include "peak/node_map/peak_node_map.hpp"
24
25#include <type_traits>
26#include <cstdint>
27#include <exception>
28#include <string>
29#include <tuple>
30#include <utility>
31#include <vector>
32#include <memory>
33#include <functional>
34
35#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L
36# define PEAK_AFL_NO_DISCARD [[nodiscard]]
37# define PEAK_AFL_MAYBE_UNUSED [[maybe_unused]]
38#else
39# ifdef _MSC_VER
40# define PEAK_AFL_NO_DISCARD _Check_return_
41# define PEAK_AFL_MAYBE_UNUSED
42# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
43# define PEAK_AFL_NO_DISCARD __attribute__((warn_unused_result))
44# define PEAK_AFL_MAYBE_UNUSED __attribute__((unused))
45# else
46# define PEAK_AFL_NO_DISCARD
47# define PEAK_AFL_MAYBE_UNUSED
48# endif
49#endif
50
63namespace peak
64{
65namespace afl
66{
67namespace library
68{
69
75{
76 std::uint32_t major;
77 std::uint32_t minor;
78 std::uint32_t subminor;
79 std::uint32_t patch;
80
85 PEAK_AFL_NO_DISCARD std::string ToString() const
86 {
87 return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(subminor) + "."
88 + std::to_string(patch);
89 }
90
96 PEAK_AFL_NO_DISCARD uint32_t Major() const
97 {
98 return major;
99 }
100
106 PEAK_AFL_NO_DISCARD uint32_t Minor() const
107 {
108 return minor;
109 }
115 PEAK_AFL_NO_DISCARD uint32_t Subminor() const
116 {
117 return subminor;
118 }
119
125 PEAK_AFL_NO_DISCARD uint32_t Patch() const
126 {
127 return patch;
128 }
129};
130
144inline void Init();
145
159inline void Exit();
160
168PEAK_AFL_NO_DISCARD inline std::string GetLastError();
169
182PEAK_AFL_NO_DISCARD inline Version_t Version();
183} // namespace library
184
185namespace error
186{
187
188
193class Exception : public std::exception
194{
195public:
196 explicit Exception(peak_afl_status code, bool get_text=true)
197 : m_code(code)
198 {
199 if (get_text)
200 {
201 m_text = library::GetLastError();
202 }
203 }
204
210 PEAK_AFL_NO_DISCARD peak_afl_status code() const
211 {
212 return m_code;
213 }
214
220 PEAK_AFL_NO_DISCARD const char* what() const noexcept override
221 {
222 if(m_text.empty())
223 {
224 return "-";
225 }
226 else
227 {
228 return m_text.c_str();
229 }
230 }
231
239 PEAK_AFL_NO_DISCARD static std::string translateCode(peak_afl_status status)
240 {
241 switch(status)
242 {
244 return "PEAK_AFL_STATUS_SUCCESS";
245
247 return "PEAK_AFL_STATUS_ERROR";
248
250 return "PEAK_AFL_STATUS_NOT_INITIALIZED";
251
253 return "PEAK_AFL_STATUS_INVALID_PARAMETER";
254
256 return "PEAK_AFL_STATUS_ACCESS_DENIED";
257
259 return "PEAK_AFL_STATUS_BUSY";
260
262 return "PEAK_AFL_STATUS_BUFFER_TOO_SMALL";
263
265 return "PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT";
266
268 return "PEAK_AFL_STATUS_NOT_SUPPORTED";
269
270 case PEAK_AFL_STATUS_VALUE_ADJUSTED:
271 return "PEAK_AFL_STATUS_VALUE_ADJUSTED";
272
273 default:
274 return "Unknown Status code";
275 }
276 }
277
278private:
279 peak_afl_status m_code{};
280 std::string m_text{};
281};
282} // namespace error
283
284class Controller;
285
291{
292public:
302 inline explicit Manager(const std::shared_ptr<peak::core::NodeMap>& node_map);
303
307 inline ~Manager();
308
309 Manager(const Manager&) = delete;
310 inline Manager(Manager&&) noexcept;
311
312 Manager& operator=(const Manager&) noexcept = delete;
313 inline Manager& operator=(Manager&&) noexcept;
314
325 inline void AddController(const std::shared_ptr<Controller>& controller);
326
337 inline void RemoveController(const std::shared_ptr<Controller>& controller);
338
348 inline void Process(const peak::ipl::Image& image) const;
349
362 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> CreateController(peak_afl_controllerType type);
363
371 inline void DestroyAllController();
372
382 inline void DestroyController(const std::shared_ptr<Controller>& controller);
383
391 inline void SetGainIPL(const peak::ipl::Gain& gain);
392
402 PEAK_AFL_NO_DISCARD inline bool Status() const;
403
409 PEAK_AFL_NO_DISCARD inline std::vector<std::shared_ptr<Controller>> ControllerList() const;
410
416 PEAK_AFL_NO_DISCARD inline size_t ControllerCount() const;
417
427 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> GetController(peak_afl_controllerType type) const;
428
429private:
430 std::vector<std::shared_ptr<Controller>> m_controllerList;
431 mutable std::mutex m_mutex{};
432 peak_afl_manager_handle m_handle{};
433};
434
444template<typename... ControllerTypes>
445std::tuple<Manager, std::vector<std::shared_ptr<Controller>>>
446CreateManager(const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
447{
448 constexpr int size = sizeof...(types);
449 constexpr std::array<peak_afl_controllerType, size> controller_types{types...};
450 std::vector<std::shared_ptr<Controller>> controller{};
451 Manager manager{node_map};
452 controller.reserve(size);
453
454 std::for_each(controller_types.cbegin(), controller_types.cend(), [&manager, &controller](peak_afl_controllerType type) {
455 controller.emplace_back(std::move(manager.CreateController(type)));
456 });
457
458 return { std::move(manager), std::move(controller) };
459}
460
461
466template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
467struct Range
468{
469 T min;
470 T max;
471 T inc;
472};
473
474namespace callback
475{
476using FinishedCallback = std::function<void(void)>;
477using DataProcessingCallback = std::function<void(int, int)>;
478using ComponentCallback = std::function<void(void)>;
479
480using RegisterFunction = std::function<PEAK_AFL_API_STATUS(void*, void*)>;
481using UnRegisterFunction = std::function<void()>;
482}
483
488class Controller : public std::enable_shared_from_this<Controller>
489{
490 friend class Manager;
491
492 template<class T>
493 class Callback
494 {
495#ifndef SWIG
496 public:
497 template<typename R, typename ...Args>
498 Callback(const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
499 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback) :
500 m_callback(std::move(callback)),
501 m_unregister_function(std::move(unregister_function))
502 {
503 const auto ret = register_function(reinterpret_cast<void*>(&Callback::Func<Args...>), this);
504 if (ret != PEAK_AFL_STATUS_SUCCESS)
505 {
506 throw error::Exception(ret);
507 }
508 m_controller = controller;
509 }
510
511 virtual ~Callback()
512 {
513 if (auto controller = m_controller.lock())
514 {
515 m_unregister_function();
516 }
517 }
518
519 private:
520 template<typename ...Args>
521 static void Func(Args... args, void* ptr)
522 {
523 static_cast<Callback *>(ptr)->m_callback(args...);
524 };
525#endif
526
527 std::weak_ptr<peak::afl::Controller> m_controller{};
528 callback::UnRegisterFunction m_unregister_function{};
529 T m_callback{};
530 };
531
532
540 inline explicit Controller(peak_afl_controller_handle handle)
541 : m_handle(handle) {};
542
543public:
547 inline ~Controller();
548
549 Controller(const Controller&) = delete;
550 Controller(Controller&&) = delete;
551 Controller& operator=(const Controller&) = delete;
552 Controller& operator=(Controller&&) = delete;
553
563 PEAK_AFL_NO_DISCARD inline static std::shared_ptr<Controller> Create(peak_afl_controllerType type);
564
572 PEAK_AFL_NO_DISCARD inline bool IsSkipFramesSupported() const;
573
583 inline void SetSkipFrames(std::uint32_t count);
584
594 PEAK_AFL_NO_DISCARD inline std::uint32_t GetSkipFrames() const;
595
603 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetSkipFramesRange() const;
604
614 PEAK_AFL_NO_DISCARD inline bool IsROISupported() const;
615
625 inline void SetROI(peak_afl_rectangle rect);
626
636 PEAK_AFL_NO_DISCARD inline peak_afl_rectangle GetROI() const;
637
647 PEAK_AFL_NO_DISCARD inline bool IsROIPresetSupported() const;
648
658 inline void SetROIPreset(peak_afl_roi_preset preset);
659
669 PEAK_AFL_NO_DISCARD inline bool IsModeSupported() const;
670
680 inline void SetMode(peak_afl_controller_automode mode);
681
689 PEAK_AFL_NO_DISCARD inline peak_afl_controller_automode GetMode() const;
690
700 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status Status() const;
701
711 PEAK_AFL_NO_DISCARD inline std::uint8_t GetLastAutoAverage() const;
712
722 PEAK_AFL_NO_DISCARD inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> GetLastAutoAverages() const;
723
733 PEAK_AFL_NO_DISCARD inline bool IsAutoTargetSupported() const;
734
745 inline void SetAutoTarget(uint32_t target);
746
754 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTarget() const;
755
766 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoTargetRange() const;
767
777 PEAK_AFL_NO_DISCARD inline bool IsAutoToleranceSupported() const;
778
788 inline void SetAutoTolerance(std::uint32_t tolerance);
789
797 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTolerance() const;
798
809 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoToleranceRange() const;
810
820 PEAK_AFL_NO_DISCARD inline bool IsAutoPercentileSupported() const;
821
832 inline void SetAutoPercentile(double percentile);
833
841 PEAK_AFL_NO_DISCARD inline double GetAutoPercentile() const;
842
853 PEAK_AFL_NO_DISCARD inline Range<double> GetAutoPercentileRange() const;
854
864 PEAK_AFL_NO_DISCARD inline peak_afl_controllerType Type() const;
865
877 PEAK_AFL_NO_DISCARD inline bool IsAlgorithmSupported() const;
878
888 inline void SetAlgorithm(peak_afl_controller_algorithm algorithm);
889
896 PEAK_AFL_NO_DISCARD inline peak_afl_controller_algorithm GetAlgorithm() const;
897
907 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_algorithm> GetAlgorithmList() const;
908
920 PEAK_AFL_NO_DISCARD inline bool IsSharpnessAlgorithmSupported() const;
921
932
940 PEAK_AFL_NO_DISCARD inline peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const;
941
951 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_sharpness_algorithm> GetSharpnessAlgorithmList() const;
952
956 inline void RegisterFinishedCallback(const callback::FinishedCallback& callback);
957
961 inline void UnRegisterFinishedCallback();
962
966 inline void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback);
967
972
977 inline void RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback);
978
983
993 PEAK_AFL_NO_DISCARD inline bool IsWeightedROISupported() const;
994
1004 inline void SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list);
1005
1015 inline void SetWeightedROI(const peak_afl_weighted_rectangle& rect);
1016
1024 PEAK_AFL_NO_DISCARD inline peak_afl_size GetWeightedROIMinSize() const;
1025
1033 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_weighted_rectangle> GetWeightedROIs() const;
1034
1044 PEAK_AFL_NO_DISCARD inline bool IsLimitSupported() const;
1045
1055 inline void SetLimit(peak_afl_controller_limit limit);
1056
1064 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetLimit() const;
1065
1073 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetDefaultLimit() const;
1074
1084 PEAK_AFL_NO_DISCARD inline bool IsHysteresisSupported() const;
1085
1095 inline void SetHysteresis(std::uint8_t hysteresis);
1096
1104 PEAK_AFL_NO_DISCARD inline std::uint8_t GetHysteresis() const;
1105
1113 PEAK_AFL_NO_DISCARD inline std::uint8_t GetDefaultHysteresis() const;
1114
1122 PEAK_AFL_NO_DISCARD inline Range<std::uint8_t> GetHysteresisRange() const;
1123
1133 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentModeSupported() const;
1134
1146
1156
1168
1176 PEAK_AFL_NO_DISCARD inline bool IsGainLimitSupported() const;
1177
1192 inline void SetGainLimit(peak_afl_double_limit limit);
1193
1201 inline peak_afl_double_limit GetGainLimit() const;
1202
1211
1219 inline void SetExposureLimit(peak_afl_double_limit limit);
1220
1229
1230
1231private:
1232 using FinishedCallbackType = Callback<callback::FinishedCallback>;
1233 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
1234 using ComponentCallbackType = Callback<callback::ComponentCallback>;
1235
1236 peak_afl_controller_handle m_handle{};
1237 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
1238 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
1239 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
1240 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
1241};
1242
1243namespace library
1244{
1245inline void Init()
1246{
1247 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Init();
1248 if (ret != PEAK_AFL_STATUS_SUCCESS)
1249
1250 {
1251 throw error::Exception(ret, false);
1252 }
1253}
1254
1255inline void Exit()
1256{
1257 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Exit();
1258 if (ret != PEAK_AFL_STATUS_SUCCESS)
1259 {
1260 throw error::Exception(ret, false);
1261 }
1262}
1263
1265{
1266 Version_t version{};
1267
1268 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetVersion(&version.major, &version.minor, &version.subminor, &version.patch);
1269 if (ret != PEAK_AFL_STATUS_SUCCESS)
1270 {
1271 throw error::Exception(ret, false);
1272 }
1273
1274 return version;
1275}
1276
1277inline std::string GetLastError()
1278{
1279 std::size_t lastErrorMessageSize;
1280 peak_afl_status code;
1281
1282 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, nullptr, &lastErrorMessageSize);
1283 if (ret != PEAK_AFL_STATUS_SUCCESS)
1284 {
1285 return "Cannot get last error!";
1286 }
1287
1288 std::vector<char> text;
1289 text.resize(lastErrorMessageSize);
1290
1291 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, text.data(), &lastErrorMessageSize);
1292 if (ret != PEAK_AFL_STATUS_SUCCESS)
1293 {
1294 return "Cannot get last error!";
1295 }
1296
1297 return { text.begin(), text.end() };
1298}
1299} // namespace library
1300
1301inline Manager::Manager(const std::shared_ptr<peak::core::NodeMap>& node_map)
1302{
1303 if(!node_map)
1304 {
1305 throw std::runtime_error("Invalid node map handle!");
1306 }
1307
1308 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Create(&m_handle, node_map->Handle());
1309 if (ret != PEAK_AFL_STATUS_SUCCESS)
1310 {
1311 throw error::Exception(ret);
1312 }
1313}
1314
1316{
1317 if (m_handle != nullptr)
1318 {
1319 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
1320
1321 {
1322 std::lock_guard<std::mutex> lck(m_mutex);
1323 for (auto& c : m_controllerList)
1324 {
1325 c->m_handle = nullptr;
1326 }
1327 }
1328
1329 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Destroy(m_handle);
1330 m_handle = nullptr;
1331 }
1332}
1333
1334inline Manager::Manager(Manager&& other) noexcept {
1335 m_handle = other.m_handle;
1336 other.m_handle = nullptr;
1337
1338 std::lock_guard<std::mutex> lck(other.m_mutex);
1339 m_controllerList = std::move(other.m_controllerList);
1340}
1341
1342inline Manager& Manager::operator=(Manager&& other) noexcept
1343{
1344 m_handle = other.m_handle;
1345 other.m_handle = nullptr;
1346
1347 std::lock_guard<std::mutex> lck(other.m_mutex);
1348 m_controllerList = std::move(other.m_controllerList);
1349
1350 return *this;
1351}
1352
1353inline void Manager::AddController(const std::shared_ptr<Controller>& controller)
1354{
1355 std::lock_guard<std::mutex> lck(m_mutex);
1356
1357 auto cnt = std::any_of(m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) {
1358 return c == controller;
1359 });
1360
1361 if(cnt)
1362 {
1363 return;
1364 }
1365
1366 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_AddController(m_handle, controller->m_handle);
1367 if (ret != PEAK_AFL_STATUS_SUCCESS)
1368 {
1369 throw error::Exception(ret);
1370 }
1371
1372 m_controllerList.emplace_back(controller);
1373}
1374
1375inline void Manager::RemoveController(const std::shared_ptr<Controller>& controller)
1376{
1377 std::lock_guard<std::mutex> lck(m_mutex);
1378
1379 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_RemoveController(m_handle, controller->m_handle);
1380 if (ret != PEAK_AFL_STATUS_SUCCESS)
1381 {
1382 throw error::Exception(ret);
1383 }
1384
1385 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) {
1386 return c == controller;
1387 });
1388
1389 m_controllerList.erase(it, m_controllerList.end());
1390}
1391
1392inline void Manager::Process(const peak::ipl::Image& image) const
1393{
1394 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Process(m_handle, ImageBackendAccessor::BackendHandle(image));
1395 if (ret != PEAK_AFL_STATUS_SUCCESS)
1396 {
1397 throw error::Exception(ret);
1398 }
1399}
1400
1401inline std::shared_ptr<Controller> Manager::CreateController(peak_afl_controllerType type)
1402{
1403 std::lock_guard<std::mutex> lck(m_mutex);
1404
1406 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_CreateController(m_handle, &handle, type);
1407 if (ret != PEAK_AFL_STATUS_SUCCESS)
1408 {
1409 throw error::Exception(ret);
1410 }
1411
1412 auto shared = std::shared_ptr<Controller>(new Controller(handle));
1413 m_controllerList.emplace_back(shared);
1414
1415 return shared;
1416}
1417
1419{
1420 std::lock_guard<std::mutex> lck(m_mutex);
1421
1422 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
1423 if (ret != PEAK_AFL_STATUS_SUCCESS)
1424 {
1425 throw error::Exception(ret);
1426 }
1427
1428 for(auto& c : m_controllerList)
1429 {
1430 c->m_handle = nullptr;
1431 }
1432
1433 m_controllerList.clear();
1434}
1435
1436inline void Manager::DestroyController(const std::shared_ptr<Controller>& controller)
1437{
1438 std::lock_guard<std::mutex> lck(m_mutex);
1439
1440 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyController(m_handle, controller->m_handle);
1441 if (ret != PEAK_AFL_STATUS_SUCCESS)
1442 {
1443 throw error::Exception(ret);
1444 }
1445
1446 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) {
1447 return c == controller;
1448 });
1449
1450 m_controllerList.erase(it, m_controllerList.end());
1451
1452 controller->m_handle = nullptr;
1453}
1454
1455inline void Manager::SetGainIPL(const peak::ipl::Gain& gain)
1456{
1457 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetGainIPL(m_handle, GainBackendAccessor::BackendHandle(gain));
1458 if (ret != PEAK_AFL_STATUS_SUCCESS)
1459 {
1460 throw error::Exception(ret);
1461 }
1462}
1463
1464inline bool Manager::Status() const
1465{
1466 std::uint8_t status;
1467 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Status(m_handle, &status);
1468 if (ret != PEAK_AFL_STATUS_SUCCESS)
1469 {
1470 throw error::Exception(ret);
1471 }
1472
1473 return status;
1474}
1475
1476inline std::vector<std::shared_ptr<Controller>> Manager::ControllerList() const
1477{
1478 std::lock_guard<std::mutex> lck(m_mutex);
1479
1480 std::vector<std::shared_ptr<Controller>> controller{};
1481
1482 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
1483
1484 return controller;
1485}
1486
1487inline size_t Manager::ControllerCount() const
1488{
1489 return m_controllerList.size();
1490}
1491
1492inline std::shared_ptr<Controller> Manager::GetController(peak_afl_controllerType type) const
1493{
1494 std::lock_guard<std::mutex> lck(m_mutex);
1495
1496 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(), [=](const std::shared_ptr<Controller>& controller) {
1497 return type == controller->Type();
1498 });
1499
1500 if(it != m_controllerList.cend())
1501 {
1502 return *it;
1503 }
1504 else
1505 {
1507 }
1508}
1509
1510inline std::shared_ptr<Controller> Controller::Create(peak_afl_controllerType type)
1511{
1513 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Create(&handle, type);
1514 if (ret != PEAK_AFL_STATUS_SUCCESS)
1515 {
1516 throw error::Exception(ret);
1517 }
1518
1519 return std::shared_ptr<Controller>(new Controller(handle));
1520}
1521
1523{
1524 if (m_handle != nullptr)
1525 {
1526 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Destroy(m_handle);
1527 m_handle = nullptr;
1528 }
1529}
1530
1532{
1533 peak_afl_BOOL8 supported{};
1534 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_IsSupported(m_handle, &supported);
1535 if (ret != PEAK_AFL_STATUS_SUCCESS)
1536 {
1537 throw error::Exception(ret);
1538 }
1539
1540 return supported;
1541}
1542
1543inline void Controller::SetSkipFrames(std::uint32_t count)
1544{
1545 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Set(m_handle, count);
1546 if (ret != PEAK_AFL_STATUS_SUCCESS)
1547 {
1548 throw error::Exception(ret);
1549 }
1550}
1551
1552inline std::uint32_t Controller::GetSkipFrames() const
1553{
1554 std::uint32_t count{};
1555 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Get(m_handle, &count);
1556 if (ret != PEAK_AFL_STATUS_SUCCESS)
1557 {
1558 throw error::Exception(ret);
1559 }
1560
1561 return count;
1562}
1563
1565{
1566 Range<std::uint32_t> range{};
1567 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_GetRange(m_handle, &range.min, &range.max, &range.inc);
1568 if (ret != PEAK_AFL_STATUS_SUCCESS)
1569 {
1570 throw error::Exception(ret);
1571 }
1572
1573 return range;
1574}
1575
1577{
1578 peak_afl_BOOL8 supported{};
1579 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_IsSupported(m_handle, &supported);
1580 if (ret != PEAK_AFL_STATUS_SUCCESS)
1581 {
1582 throw error::Exception(ret);
1583 }
1584
1585 return supported;
1586}
1587
1589{
1590 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Set(m_handle, rect);
1591 if (ret != PEAK_AFL_STATUS_SUCCESS)
1592 {
1593 throw error::Exception(ret);
1594 }
1595}
1596
1598{
1599 peak_afl_rectangle rect{};
1600 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Get(m_handle, &rect);
1601 if (ret != PEAK_AFL_STATUS_SUCCESS)
1602 {
1603 throw error::Exception(ret);
1604 }
1605 return rect;
1606}
1607
1609{
1610 peak_afl_BOOL8 supported{};
1611 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_IsSupported(m_handle, &supported);
1612 if (ret != PEAK_AFL_STATUS_SUCCESS)
1613 {
1614 throw error::Exception(ret);
1615 }
1616
1617 return supported;
1618}
1619
1621{
1622 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_Set(m_handle, preset);
1623 if (ret != PEAK_AFL_STATUS_SUCCESS)
1624 {
1625 throw error::Exception(ret);
1626 }
1627}
1628
1630{
1631 peak_afl_BOOL8 supported{};
1632 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_IsSupported(m_handle, &supported);
1633 if (ret != PEAK_AFL_STATUS_SUCCESS)
1634 {
1635 throw error::Exception(ret);
1636 }
1637
1638 return supported;
1639}
1640
1642{
1643 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Set(m_handle, mode);
1644 if (ret != PEAK_AFL_STATUS_SUCCESS)
1645 {
1646 throw error::Exception(ret);
1647 }
1648}
1649
1651{
1653 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Get(m_handle, &mode);
1654 if (ret != PEAK_AFL_STATUS_SUCCESS)
1655 {
1656 throw error::Exception(ret);
1657 }
1658 return mode;
1659}
1660
1662{
1664 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Status(m_handle, &status);
1665 if (ret != PEAK_AFL_STATUS_SUCCESS)
1666 {
1667 throw error::Exception(ret);
1668 }
1669 return status;
1670}
1671
1672
1673inline std::uint8_t Controller::GetLastAutoAverage() const
1674{
1675 std::uint8_t average{};
1676 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverage(m_handle, &average);
1677 if (ret != PEAK_AFL_STATUS_SUCCESS)
1678 {
1679 throw error::Exception(ret);
1680 }
1681 return average;
1682}
1683
1684inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> Controller::GetLastAutoAverages() const
1685{
1686 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
1687 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverages(m_handle, &averageRed, &averageGreen, &averageBlue);
1688 if (ret != PEAK_AFL_STATUS_SUCCESS)
1689 {
1690 throw error::Exception(ret);
1691 }
1692 return { averageRed, averageGreen, averageBlue };
1693}
1694
1696{
1697 peak_afl_BOOL8 supported{};
1698 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_IsSupported(m_handle, &supported);
1699 if (ret != PEAK_AFL_STATUS_SUCCESS)
1700 {
1701 throw error::Exception(ret);
1702 }
1703
1704 return supported;
1705}
1706
1707inline void Controller::SetAutoTarget(std::uint32_t target)
1708{
1709 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Set(m_handle, target);
1710 if (ret != PEAK_AFL_STATUS_SUCCESS)
1711 {
1712 throw error::Exception(ret);
1713 }
1714}
1715
1716inline std::uint32_t Controller::GetAutoTarget() const
1717{
1718 std::uint32_t target{};
1719 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Get(m_handle, &target);
1720 if (ret != PEAK_AFL_STATUS_SUCCESS)
1721 {
1722 throw error::Exception(ret);
1723 }
1724 return target;
1725}
1726
1728{
1729 Range<std::uint32_t> range{};
1730 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_GetRange(m_handle, &range.min, &range.max, &range.inc);
1731 if (ret != PEAK_AFL_STATUS_SUCCESS)
1732 {
1733 throw error::Exception(ret);
1734 }
1735 return range;
1736}
1737
1739{
1740 peak_afl_BOOL8 supported{};
1741 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_IsSupported(m_handle, &supported);
1742 if (ret != PEAK_AFL_STATUS_SUCCESS)
1743 {
1744 throw error::Exception(ret);
1745 }
1746
1747 return supported;
1748}
1749
1750inline void Controller::SetAutoTolerance(uint32_t tolerance)
1751{
1752 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Set(m_handle, tolerance);
1753 if (ret != PEAK_AFL_STATUS_SUCCESS)
1754 {
1755 throw error::Exception(ret);
1756 }
1757}
1758
1759inline uint32_t Controller::GetAutoTolerance() const
1760{
1761 std::uint32_t tolerance;
1762 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Get(m_handle, &tolerance);
1763 if (ret != PEAK_AFL_STATUS_SUCCESS)
1764 {
1765 throw error::Exception(ret);
1766 }
1767 return tolerance;
1768}
1769
1771{
1772 Range<uint32_t> range{};
1773 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_GetRange(m_handle, &range.min, &range.max, &range.inc);
1774 if (ret != PEAK_AFL_STATUS_SUCCESS)
1775 {
1776 throw error::Exception(ret);
1777 }
1778 return range;
1779}
1780
1782{
1783 peak_afl_BOOL8 supported{};
1784 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_IsSupported(m_handle, &supported);
1785 if (ret != PEAK_AFL_STATUS_SUCCESS)
1786 {
1787 throw error::Exception(ret);
1788 }
1789
1790 return supported;
1791}
1792
1793inline void Controller::SetAutoPercentile(double percentile)
1794{
1795 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Set(m_handle, percentile);
1796 if (ret != PEAK_AFL_STATUS_SUCCESS)
1797 {
1798 throw error::Exception(ret);
1799 }
1800}
1801
1803{
1804 double percentile;
1805 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Get(m_handle, &percentile);
1806 if (ret != PEAK_AFL_STATUS_SUCCESS)
1807 {
1808 throw error::Exception(ret);
1809 }
1810 return percentile;
1811}
1812
1814{
1815 Range<double> range{};
1816 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_GetRange(m_handle, &range.min, &range.max, &range.inc);
1817 if (ret != PEAK_AFL_STATUS_SUCCESS)
1818 {
1819 throw error::Exception(ret);
1820 }
1821 return range;
1822}
1823
1825{
1827 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Type_Get(m_handle, &type);
1828 if (ret != PEAK_AFL_STATUS_SUCCESS)
1829 {
1830 throw error::Exception(ret);
1831 }
1832 return type;
1833}
1834
1836{
1837 peak_afl_BOOL8 supported{};
1838 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_IsSupported(m_handle, &supported);
1839 if (ret != PEAK_AFL_STATUS_SUCCESS)
1840 {
1841 throw error::Exception(ret);
1842 }
1843
1844 return supported;
1845}
1846
1848{
1849 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Set(m_handle, alg);
1850 if (ret != PEAK_AFL_STATUS_SUCCESS)
1851 {
1852 throw error::Exception(ret);
1853 }
1854}
1855
1857{
1859 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Get(m_handle, &alg);
1860 if (ret != PEAK_AFL_STATUS_SUCCESS)
1861 {
1862 throw error::Exception(ret);
1863 }
1864
1865 return alg;
1866}
1867
1868inline std::vector<peak_afl_controller_algorithm> Controller::GetAlgorithmList() const
1869{
1870 std::vector<peak_afl_controller_algorithm> algList{};
1871 std::uint32_t listSize{};
1872
1873 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, nullptr, &listSize);
1874 if (ret != PEAK_AFL_STATUS_SUCCESS)
1875 {
1876 throw error::Exception(ret);
1877 }
1878
1879 algList.resize(listSize);
1880
1881 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, algList.data(), &listSize);
1882 if (ret != PEAK_AFL_STATUS_SUCCESS)
1883 {
1884 throw error::Exception(ret);
1885 }
1886
1887 return algList;
1888}
1889
1891{
1892 peak_afl_BOOL8 supported{};
1893 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_IsSupported(m_handle, &supported);
1894 if (ret != PEAK_AFL_STATUS_SUCCESS)
1895 {
1896 throw error::Exception(ret);
1897 }
1898
1899 return supported;
1900}
1901
1903{
1904 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Set(m_handle, alg);
1905 if (ret != PEAK_AFL_STATUS_SUCCESS)
1906 {
1907 throw error::Exception(ret);
1908 }
1909}
1910
1912{
1914 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Get(m_handle, &alg);
1915 if (ret != PEAK_AFL_STATUS_SUCCESS)
1916 {
1917 throw error::Exception(ret);
1918 }
1919
1920 return alg;
1921}
1922
1923inline std::vector<peak_afl_controller_sharpness_algorithm> Controller::GetSharpnessAlgorithmList() const
1924{
1925 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
1926 std::uint32_t listSize{};
1927
1928 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, nullptr, &listSize);
1929 if (ret != PEAK_AFL_STATUS_SUCCESS)
1930 {
1931 throw error::Exception(ret);
1932 }
1933
1934 algList.resize(listSize);
1935
1936 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, algList.data(), &listSize);
1937 if (ret != PEAK_AFL_STATUS_SUCCESS)
1938 {
1939 throw error::Exception(ret);
1940 }
1941
1942 return algList;
1943}
1944
1945inline void Controller::RegisterFinishedCallback(const callback::FinishedCallback& callback)
1946{
1947 m_finishedCallback = std::make_unique<FinishedCallbackType>(shared_from_this(),
1948 [handle = m_handle](void* ptr, void* ctx) {
1949 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx); },
1950 [handle = m_handle] {
1951 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr); },
1952 callback);
1953}
1954
1956{
1957 m_finishedCallback.reset();
1958}
1959
1960inline void Controller::RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback)
1961{
1963 {
1965 }
1966
1968 {
1969 m_finishedExposureCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
1970 [handle = m_handle, component](void* ptr, void* ctx) {
1972 ptr, ctx); },
1973 [handle = m_handle, component] {
1975 nullptr, nullptr); },
1976 callback);
1977 }
1979 {
1980 m_finishedGainCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
1981 [handle = m_handle, component](void* ptr, void* ctx) {
1983 ptr, ctx); },
1984 [handle = m_handle, component] {
1986 nullptr, nullptr); },
1987 callback);
1988 }
1989 else
1990 {
1992 }
1993}
1994
1996{
1998 {
1999 m_finishedExposureCallback.reset();
2000 }
2002 {
2003 m_finishedGainCallback.reset();
2004 }
2005 else
2006 {
2008 }
2009}
2010
2011inline void Controller::RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback)
2012{
2013 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(shared_from_this(),
2014 [handle = m_handle](void* ptr, void* ctx) {
2015 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, ptr, ctx); },
2016 [handle = m_handle] {
2017 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, nullptr, nullptr);},
2018 callback);
2019}
2020
2022{
2023 m_dataProcessingCallback.reset();
2024}
2025
2027{
2028 peak_afl_BOOL8 supported{};
2029 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_IsSupported(m_handle, &supported);
2030 if (ret != PEAK_AFL_STATUS_SUCCESS)
2031 {
2032 throw error::Exception(ret);
2033 }
2034
2035 return supported;
2036}
2037
2038inline void Controller::SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list)
2039{
2040 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, list.data(), static_cast<uint32_t>(list.size()));
2041 if (ret != PEAK_AFL_STATUS_SUCCESS)
2042 {
2043 throw error::Exception(ret);
2044 }
2045}
2046
2048{
2049 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, &rect, 1);
2050 if (ret != PEAK_AFL_STATUS_SUCCESS)
2051 {
2052 throw error::Exception(ret);
2053 }
2054}
2055
2057{
2058 peak_afl_size minSize{};
2059 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Min_Size(m_handle, &minSize);
2060 if (ret != PEAK_AFL_STATUS_SUCCESS)
2061 {
2062 throw error::Exception(ret);
2063 }
2064 return minSize;
2065}
2066
2067inline std::vector<peak_afl_weighted_rectangle> Controller::GetWeightedROIs() const
2068{
2069 std::vector<peak_afl_weighted_rectangle> list;
2070 std::uint32_t listSize{};
2071
2072 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, nullptr, &listSize);
2073 if (ret != PEAK_AFL_STATUS_SUCCESS)
2074 {
2075 throw error::Exception(ret);
2076 }
2077
2078 list.resize(listSize);
2079
2080 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, list.data(), &listSize);
2081 if (ret != PEAK_AFL_STATUS_SUCCESS)
2082 {
2083 throw error::Exception(ret);
2084 }
2085
2086 return list;
2087}
2088
2090{
2091 peak_afl_BOOL8 supported{};
2092 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_IsSupported(m_handle, &supported);
2093 if (ret != PEAK_AFL_STATUS_SUCCESS)
2094 {
2095 throw error::Exception(ret);
2096 }
2097
2098 return supported;
2099}
2100
2102{
2103 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Set(m_handle, limit);
2104 if (ret != PEAK_AFL_STATUS_SUCCESS)
2105 {
2106 throw error::Exception(ret);
2107 }
2108}
2109
2111{
2113 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Get(m_handle, &limit);
2114 if (ret != PEAK_AFL_STATUS_SUCCESS)
2115 {
2116 throw error::Exception(ret);
2117 }
2118 return limit;
2119}
2120
2122{
2124 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Default(m_handle, &limit);
2125 if (ret != PEAK_AFL_STATUS_SUCCESS)
2126 {
2127 throw error::Exception(ret);
2128 }
2129 return limit;
2130}
2131
2133{
2134 peak_afl_BOOL8 supported{};
2135 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_IsSupported(m_handle, &supported);
2136 if (ret != PEAK_AFL_STATUS_SUCCESS)
2137 {
2138 throw error::Exception(ret);
2139 }
2140
2141 return supported;
2142}
2143
2144inline void Controller::SetHysteresis(std::uint8_t hysteresis)
2145{
2146 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Set(m_handle, hysteresis);
2147 if (ret != PEAK_AFL_STATUS_SUCCESS)
2148 {
2149 throw error::Exception(ret);
2150 }
2151}
2152
2153inline std::uint8_t Controller::GetHysteresis() const
2154{
2155 std::uint8_t hysteresis{};
2156 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Get(m_handle, &hysteresis);
2157 if (ret != PEAK_AFL_STATUS_SUCCESS)
2158 {
2159 throw error::Exception(ret);
2160 }
2161
2162 return hysteresis;
2163}
2164
2165inline std::uint8_t Controller::GetDefaultHysteresis() const
2166{
2167 std::uint8_t hysteresis{};
2168 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Default(m_handle, &hysteresis);
2169 if (ret != PEAK_AFL_STATUS_SUCCESS)
2170 {
2171 throw error::Exception(ret);
2172 }
2173
2174 return hysteresis;
2175}
2176
2178{
2179 Range<std::uint8_t> hysteresis{};
2180 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_GetRange(
2181 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
2182 if (ret != PEAK_AFL_STATUS_SUCCESS)
2183 {
2184 throw error::Exception(ret);
2185 }
2186
2187 return hysteresis;
2188}
2189
2190PEAK_AFL_NO_DISCARD inline bool Controller::IsBrightnessComponentModeSupported() const
2191{
2192 peak_afl_BOOL8 supported{};
2193 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(m_handle, &supported);
2194 if (ret != PEAK_AFL_STATUS_SUCCESS)
2195 {
2196 throw error::Exception(ret);
2197 }
2198
2199 return supported;
2200}
2201
2204{
2205 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Set(m_handle, component, mode);
2206 if (ret != PEAK_AFL_STATUS_SUCCESS)
2207 {
2208 throw error::Exception(ret);
2209 }
2210}
2211
2214{
2216 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Get(m_handle, component, &mode);
2217 if (ret != PEAK_AFL_STATUS_SUCCESS)
2218 {
2219 throw error::Exception(ret);
2220 }
2221 return mode;
2222}
2223
2226{
2228 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Status(m_handle, component, &status);
2229 if (ret != PEAK_AFL_STATUS_SUCCESS)
2230 {
2231 throw error::Exception(ret);
2232 }
2233 return status;
2234}
2235
2237{
2238 peak_afl_BOOL8 supported{};
2239 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_IsSupported(m_handle, &supported);
2240 if (ret != PEAK_AFL_STATUS_SUCCESS)
2241 {
2242 throw error::Exception(ret);
2243 }
2244
2245 return supported;
2246}
2247
2249{
2250 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Set(m_handle, limit);
2251 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
2252 {
2253 // Do nothing. Not an error.
2254 }
2255 else if (ret != PEAK_AFL_STATUS_SUCCESS)
2256 {
2257 throw error::Exception(ret);
2258 }
2259}
2260
2262{
2263 peak_afl_double_limit limit{};
2264 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Get(m_handle, &limit);
2265 if (ret != PEAK_AFL_STATUS_SUCCESS)
2266 {
2267 throw error::Exception(ret);
2268 }
2269
2270 return limit;
2271}
2272
2274{
2275 peak_afl_double_limit limit{};
2276 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_GetRange(m_handle, &limit);
2277 if (ret != PEAK_AFL_STATUS_SUCCESS)
2278 {
2279 throw error::Exception(ret);
2280 }
2281
2282 return limit;
2283}
2284
2286{
2287 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Set(m_handle, limit);
2288 if (ret != PEAK_AFL_STATUS_SUCCESS)
2289 {
2290 throw error::Exception(ret);
2291 }
2292}
2293
2295{
2296 peak_afl_double_limit limit{};
2297 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Get(m_handle, &limit);
2298 if (ret != PEAK_AFL_STATUS_SUCCESS)
2299 {
2300 throw error::Exception(ret);
2301 }
2302
2303 return limit;
2304}
2305
2306} /* namespace afl */
2307} /* namespace peak */
Definition peak_afl.hpp:489
PEAK_AFL_NO_DISCARD peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:1824
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:1620
PEAK_AFL_NO_DISCARD bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:1781
PEAK_AFL_NO_DISCARD bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:1738
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:2261
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:2248
PEAK_AFL_NO_DISCARD std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:2165
PEAK_AFL_NO_DISCARD std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2153
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:1641
PEAK_AFL_NO_DISCARD bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:1576
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2038
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:1955
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:1564
PEAK_AFL_NO_DISCARD bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:1608
void BrightnessComponentSetMode(peak_afl_controller_brightness_component component, peak_afl_controller_automode mode)
Set the autofeature mode for a brightness controller component.
Definition peak_afl.hpp:2202
PEAK_AFL_NO_DISCARD std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1673
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:2110
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2144
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:2285
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:1543
PEAK_AFL_NO_DISCARD std::vector< peak_afl_controller_sharpness_algorithm > GetSharpnessAlgorithmList() const
Get the list of supported sharpness algorithms for a controller.
Definition peak_afl.hpp:1923
PEAK_AFL_NO_DISCARD peak_afl_controller_automode BrightnessComponentGetMode(peak_afl_controller_brightness_component component) const
Get the current autofeature mode for a brightness controller component.
Definition peak_afl.hpp:2212
PEAK_AFL_NO_DISCARD bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:1629
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:1770
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:1793
PEAK_AFL_NO_DISCARD peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:1597
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:2294
void UnRegisterDataProcessingCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2021
PEAK_AFL_NO_DISCARD std::vector< peak_afl_controller_algorithm > GetAlgorithmList() const
Get the list of supported algorithms for a controller.
Definition peak_afl.hpp:1868
~Controller()
Definition peak_afl.hpp:1522
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:2011
PEAK_AFL_NO_DISCARD bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:1890
PEAK_AFL_NO_DISCARD peak_afl_controller_status BrightnessComponentStatus(peak_afl_controller_brightness_component component) const
Get the status for a brightness controller component.
Definition peak_afl.hpp:2224
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:1995
PEAK_AFL_NO_DISCARD std::tuple< std::uint8_t, std::uint8_t, std::uint8_t > GetLastAutoAverages() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1684
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:1759
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:1847
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:1588
PEAK_AFL_NO_DISCARD bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:1531
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:2121
PEAK_AFL_NO_DISCARD bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:2089
PEAK_AFL_NO_DISCARD peak_afl_size GetWeightedROIMinSize() const
Get the autofeature minimum size of weighted region of interest for a controller.
Definition peak_afl.hpp:2056
PEAK_AFL_NO_DISCARD peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:1650
static PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:1510
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:1945
PEAK_AFL_NO_DISCARD peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:1856
PEAK_AFL_NO_DISCARD bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:2236
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:2273
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2047
PEAK_AFL_NO_DISCARD std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:1552
PEAK_AFL_NO_DISCARD peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:1911
PEAK_AFL_NO_DISCARD peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:1661
PEAK_AFL_NO_DISCARD bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:1835
PEAK_AFL_NO_DISCARD Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:1813
PEAK_AFL_NO_DISCARD double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:1802
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:1707
PEAK_AFL_NO_DISCARD bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:2190
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:1750
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:1716
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:1727
PEAK_AFL_NO_DISCARD Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:2177
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:2101
PEAK_AFL_NO_DISCARD bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:2026
PEAK_AFL_NO_DISCARD bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:2132
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:1960
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:1902
PEAK_AFL_NO_DISCARD bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:1695
PEAK_AFL_NO_DISCARD std::vector< peak_afl_weighted_rectangle > GetWeightedROIs() const
Get the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2067
Definition peak_afl.hpp:291
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:1301
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:1375
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:1492
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:1418
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:1436
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > CreateController(peak_afl_controllerType type)
Create a controller and append it to Manager.
Definition peak_afl.hpp:1401
PEAK_AFL_NO_DISCARD size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:1487
PEAK_AFL_NO_DISCARD bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:1464
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:1315
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:1455
PEAK_AFL_NO_DISCARD std::vector< std::shared_ptr< Controller > > ControllerList() const
Get the list of the controller associated with the manager.
Definition peak_afl.hpp:1476
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:1353
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:1392
Definition peak_afl.hpp:194
PEAK_AFL_NO_DISCARD const char * what() const noexcept override
Get the string representation for the exception.
Definition peak_afl.hpp:220
static PEAK_AFL_NO_DISCARD std::string translateCode(peak_afl_status status)
Get a string representation for an error code.
Definition peak_afl.hpp:239
PEAK_AFL_NO_DISCARD peak_afl_status code() const
Get the return code for the failure.
Definition peak_afl.hpp:210
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the auto target range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Default(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature default limit.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_GetRange(peak_afl_controller_handle controller, double *min, double *max, double *inc)
Get the auto percentile range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Callback_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get range for frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Default(peak_afl_controller_handle controller, uint8_t *hysteresis)
Get the autofeature hysteresis default.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_automode *mode)
Get the current autofeature mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto percentile is supported for a controller.
peak_afl_controllerType
controller types
Definition peak_afl.h:125
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Status(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_status *status)
Get the status for a controller component.
peak_afl_controller_brightness_component
controller brightness component
Definition peak_afl.h:232
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_algorithm *algorithm)
Get the used algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_automode *mode)
Get the current brightness component mode for a controller.
peak_afl_controller_automode
controller automode
Definition peak_afl.h:144
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto target is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Get(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Status(peak_afl_controller_handle controller, peak_afl_controller_status *status)
Get the status for a controller.
peak_afl_roi_preset
controller roi preset
Definition peak_afl.h:287
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_Get(peak_afl_controller_handle controller, uint32_t *target)
Get the currently set auto target for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_GetList(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *typeList, uint32_t *listSize)
Get the list of supported sharpness algorithms for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Set(peak_afl_controller_handle controller, uint32_t count)
Set number of frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Get(peak_afl_controller_handle controller, uint32_t *count)
Get number of frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_Set(peak_afl_controller_handle controller, uint32_t tolerance)
Set the auto tolerance for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Set(peak_afl_controller_handle controller, const peak_afl_weighted_rectangle *weightedRoiList, uint32_t listSize)
Set the autofeature weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_Set(peak_afl_controller_handle controller, peak_afl_roi_preset roiPreset)
Set the autofeature region of interest preset for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Set(peak_afl_controller_handle controller, uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Get(peak_afl_controller_handle controller, peak_afl_weighted_rectangle *weightedRoiList, uint32_t *listSize)
Get the autofeature weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if auto mode is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if skip frames is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Set(peak_afl_controller_handle controller, peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Get(peak_afl_controller_handle controller, peak_afl_rectangle *roi)
Get the autofeature region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature exposure limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Callback_Set(peak_afl_controller_handle controller, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Get(peak_afl_controller_handle controller, uint8_t *hysteresis)
Get the autofeature hysteresis for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if hysteresis is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if ROI preset is supported for a controller.
peak_afl_controller_status
controller status
Definition peak_afl.h:160
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto tolerance is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature exposure limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Create(peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a new controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_automode mode)
Set the autofeature mode for a brightness component.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Min_Size(peak_afl_controller_handle controller, peak_afl_size *size)
Get the autofeature minimum size for the weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if weighted region of interest is supported for a controller.
peak_afl_controller_algorithm
controller algorithm
Definition peak_afl.h:188
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_Set(peak_afl_controller_handle controller, double percentile)
Set the auto percentile for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if setting an algorithm is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if limit is supported for a controller.
peak_afl_controller_sharpness_algorithm
controller sharpness algorithm (focus)
Definition peak_afl.h:210
PEAK_AFL_API_STATUS peak_afl_AutoController_GetLastAutoAverage(peak_afl_controller_handle controller, uint8_t *average)
Get the last auto average for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GetLastAutoAverages(peak_afl_controller_handle controller, uint8_t *averageRed, uint8_t *averageGreen, uint8_t *averageBlue)
Get the last auto average for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_Set(peak_afl_controller_handle controller, uint32_t target)
Set the auto target for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Set(peak_afl_controller_handle controller, peak_afl_rectangle roi)
Set the autofeature region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Type_Get(peak_afl_controller_handle controller, peak_afl_controllerType *type)
Get the controller type.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_GetRange(peak_afl_controller_handle controller, uint8_t *min, uint8_t *max, uint8_t *inc)
Get autofeature hysteresis range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Destroy(peak_afl_controller_handle controller)
Destroy a controller. Will fail if it is queued inside a manager.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the auto tolerance range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_GetList(peak_afl_controller_handle controller, peak_afl_controller_algorithm *typeList, uint32_t *listSize)
Get the list of supported algorithms for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_Get(peak_afl_controller_handle controller, uint32_t *tolerance)
Get the current auto tolerance for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_Get(peak_afl_controller_handle controller, double *percentile)
Get the auto percentile for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *algorithm)
Get the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if setting a region of interest is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if brightness component mode is supported for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check setting a sharpness algorithm is supported by a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Set(peak_afl_controller_handle controller, peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if gain limit is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature gain limit for a controller.
@ PEAK_AFL_CONTROLLER_CALLBACK_FINISHED
Controller callback type finished.
Definition peak_afl.h:264
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA
Controller callback type processing data.
Definition peak_afl.h:267
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_GAIN
gain
Definition peak_afl.h:237
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_EXPOSURE
exposure
Definition peak_afl.h:234
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Create(peak_afl_manager_handle *handle, PEAK_NODE_MAP_HANDLE nodeMapHandle)
Create an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_CreateController(peak_afl_manager_handle handle, peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a controller and append it to Manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Process(peak_afl_manager_handle handle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Process an image.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyController(peak_afl_manager_handle handle, peak_afl_controller_handle controller)
Destroy a controller.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Status(peak_afl_manager_handle handle, peak_afl_BOOL8 *running)
Get the status of a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Destroy(peak_afl_manager_handle handle)
Destroy an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyAllController(peak_afl_manager_handle handle)
Destroy all controllers for a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_AddController(peak_afl_manager_handle handle, peak_afl_manager_handle controller)
Add a controller to an auto manager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_RemoveController(peak_afl_manager_handle handle, peak_afl_manager_handle controller)
Remove a controller to an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_SetGainIPL(peak_afl_manager_handle handle, PEAK_IPL_GAIN_HANDLE gainHandle)
Set the IPL Gain.
void Exit()
Exit the peak_afl auto feature library.
Definition peak_afl.hpp:1255
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:1245
PEAK_AFL_NO_DISCARD std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:1277
PEAK_AFL_NO_DISCARD Version_t Version()
Query the library version.
Definition peak_afl.hpp:1264
std::tuple< Manager, std::vector< std::shared_ptr< Controller > > > CreateManager(const std::shared_ptr< peak::core::NodeMap > &node_map, ControllerTypes... types)
Convenience function to create a manager with the supplied controllers.
Definition peak_afl.hpp:446
PEAK_AFL_API_STATUS peak_afl_Init(void)
Init the peak_afl auto feature library.
PEAK_AFL_API_STATUS peak_afl_Exit(void)
Exit the peak_afl auto feature library.
PEAK_AFL_API_STATUS peak_afl_GetVersion(uint32_t *majorVersion, uint32_t *minorVersion, uint32_t *subminorVersion, uint32_t *patchVersion)
Query the library version.
PEAK_AFL_API_STATUS peak_afl_GetLastError(peak_afl_status *lastErrorCode, char *lastErrorMessage, size_t *lastErrorMessageSize)
Get the last error message.
peak_afl_status
peak_afl Status codes
Definition peak_afl.h:88
@ PEAK_AFL_STATUS_SUCCESS
Success.
Definition peak_afl.h:90
@ PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT
Invalid image format.
Definition peak_afl.h:111
@ PEAK_AFL_STATUS_ACCESS_DENIED
Access Denied.
Definition peak_afl.h:102
@ PEAK_AFL_STATUS_BUSY
Busy.
Definition peak_afl.h:105
@ PEAK_AFL_STATUS_NOT_SUPPORTED
Not supported.
Definition peak_afl.h:114
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid Parameter.
Definition peak_afl.h:99
@ PEAK_AFL_STATUS_BUFFER_TOO_SMALL
Buffer too small.
Definition peak_afl.h:108
@ PEAK_AFL_STATUS_NOT_INITIALIZED
Library not initialized.
Definition peak_afl.h:96
@ PEAK_AFL_STATUS_ERROR
Error.
Definition peak_afl.h:93
void * peak_afl_controller_handle
opaque controller handle type
Definition peak_afl.h:49
void * peak_afl_manager_handle
opaque manager handle type
Definition peak_afl.h:51
uint8_t peak_afl_BOOL8
custom boolean type
Definition peak_afl.h:397
Definition peak_afl.hpp:468
Definition peak_afl.hpp:75
PEAK_AFL_NO_DISCARD uint32_t Minor() const
Returns the minor part of the version which is the second part of the version scheme separated by dot...
Definition peak_afl.hpp:106
std::uint32_t minor
Major.
Definition peak_afl.hpp:77
std::uint32_t subminor
Minor.
Definition peak_afl.hpp:78
PEAK_AFL_NO_DISCARD std::string ToString() const
Patch.
Definition peak_afl.hpp:85
PEAK_AFL_NO_DISCARD uint32_t Subminor() const
Returns the subminor part of the version which is the third part of the version scheme separated by d...
Definition peak_afl.hpp:115
PEAK_AFL_NO_DISCARD uint32_t Major() const
Returns the major part of the version which is the first part of the version scheme separated by dots...
Definition peak_afl.hpp:96
std::uint32_t patch
Subminor.
Definition peak_afl.hpp:79
PEAK_AFL_NO_DISCARD uint32_t Patch() const
Returns the patch part of the version which is the fourth part of the version scheme separated by dot...
Definition peak_afl.hpp:125
peak_afl Focus Limit
Definition peak_afl.h:373
peak_afl Double Limit
Definition peak_afl.h:389
peak_afl Rectangle (2D)
Definition peak_afl.h:335
peak_afl Size (2D)
Definition peak_afl.h:301
peak_afl Focus Rectangle
Definition peak_afl.h:357