Zivid C++ API 2.16.0+46cdaba6-1
LocalPointCloudRegistrationParameters.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of the Zivid API
3 *
4 * Copyright 2015-2025 (C) Zivid AS
5 * All rights reserved.
6 *
7 * Zivid Software License, v1.0
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
20 * to endorse or promote products derived from this software without specific
21 * prior written permission.
22 *
23 * 4. This software, with or without modification, must not be used with any
24 * other 3D camera than from Zivid AS.
25 *
26 * 5. Any software provided in binary form under this license must not be
27 * reverse engineered, decompiled, modified and/or disassembled.
28 *
29 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
41 * Info: http://www.zivid.com
42 ******************************************************************************/
43
44#pragma once
45
46#include <array>
47#include <chrono>
48#include <cmath>
49#include <ctime>
50#include <iomanip>
51#include <memory>
52#include <set>
53#include <sstream>
54#include <string>
55#include <tuple>
56#include <utility>
57#include <vector>
58
64#include "Zivid/Range.h"
65
66#ifdef _MSC_VER
67# pragma warning(push)
68# pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
69#endif
70
71namespace Zivid
72{
73 namespace Experimental
74 {
75
78
79 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
81 {
82 public:
84 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
85
87 static constexpr const char *path{ "" };
88
90 static constexpr const char *name{ "LocalPointCloudRegistrationParameters" };
91
93 static constexpr const char *description{
94 R"description(Input parameters for controlling the local point cloud registration process.
95)description"
96 };
97
98 static constexpr size_t version{ 1 };
99
100#ifndef NO_DOC
101 template<size_t>
102 struct Version;
103
105
106 // Short identifier. This value is not guaranteed to be universally unique
107 // Todo(ZIVID-2808): Move this to internal DataModelExt header
108 static constexpr std::array<uint8_t, 3> binaryId{ 'l', 'p', 'r' };
109
110#endif
111
114
115 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
117 {
118 public:
120 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::group;
121
123 static constexpr const char *path{ "ConvergenceCriteria" };
124
126 static constexpr const char *name{ "ConvergenceCriteria" };
127
129 static constexpr const char *description{
130 R"description(Criteria for ending iteration early. Iteration will end when all criteria are satisfied.
131)description"
132 };
133
137
138 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
140 {
141 public:
143 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
144
146 static constexpr const char *path{ "ConvergenceCriteria/RMSEDiffThreshold" };
147
149 static constexpr const char *name{ "RMSEDiffThreshold" };
150
152 static constexpr const char *description{
153 R"description(Stop iteration when the absolute change in root mean square error (RMSE) from previous iteration is less than this threshold.
154RMSE is defined as the square root of the average squared distance between corresponding points in the source and target point clouds.
155)description"
156 };
157
159 using ValueType = float;
160
162 static constexpr Range<float> validRange()
163 {
164 return { std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() };
165 }
166
168 RMSEDiffThreshold() = default;
169
171 explicit constexpr RMSEDiffThreshold(float value)
172 : m_value{ value }
173 {}
174
176 float value() const;
177
179 std::string toString() const;
180
182 bool operator==(const RMSEDiffThreshold &other) const
183 {
184 return m_value == other.m_value;
185 }
186
188 bool operator!=(const RMSEDiffThreshold &other) const
189 {
190 return m_value != other.m_value;
191 }
192
194 bool operator<(const RMSEDiffThreshold &other) const
195 {
196 return m_value < other.m_value;
197 }
198
200 bool operator>(const RMSEDiffThreshold &other) const
201 {
202 return m_value > other.m_value;
203 }
204
206 bool operator<=(const RMSEDiffThreshold &other) const
207 {
208 return m_value <= other.m_value;
209 }
210
212 bool operator>=(const RMSEDiffThreshold &other) const
213 {
214 return m_value >= other.m_value;
215 }
216
218 friend std::ostream &operator<<(std::ostream &stream, const RMSEDiffThreshold &value)
219 {
220 return stream << value.toString();
221 }
222
223 private:
224 void setFromString(const std::string &value);
225
226 float m_value{ 1e-4F };
227
228 friend struct DataModel::Detail::Befriend<RMSEDiffThreshold>;
229 };
230
234
235 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
237 {
238 public:
240 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
241
243 static constexpr const char *path{ "ConvergenceCriteria/SourceCoverageDiffThreshold" };
244
246 static constexpr const char *name{ "SourceCoverageDiffThreshold" };
247
249 static constexpr const char *description{
250 R"description(Stop iteration when the absolute change in coverage from previous iteration is less than this threshold.
251Coverage is defined as the fraction of points in the source point cloud that found a correspondence in the target point cloud.
252)description"
253 };
254
256 using ValueType = float;
257
259 static constexpr Range<float> validRange()
260 {
261 return { std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() };
262 }
263
266
268 explicit constexpr SourceCoverageDiffThreshold(float value)
269 : m_value{ value }
270 {}
271
273 float value() const;
274
276 std::string toString() const;
277
280 {
281 return m_value == other.m_value;
282 }
283
286 {
287 return m_value != other.m_value;
288 }
289
291 bool operator<(const SourceCoverageDiffThreshold &other) const
292 {
293 return m_value < other.m_value;
294 }
295
297 bool operator>(const SourceCoverageDiffThreshold &other) const
298 {
299 return m_value > other.m_value;
300 }
301
304 {
305 return m_value <= other.m_value;
306 }
307
310 {
311 return m_value >= other.m_value;
312 }
313
315 friend std::ostream &operator<<(std::ostream &stream, const SourceCoverageDiffThreshold &value)
316 {
317 return stream << value.toString();
318 }
319
320 private:
321 void setFromString(const std::string &value);
322
323 float m_value{ 1e-4F };
324
325 friend struct DataModel::Detail::Befriend<SourceCoverageDiffThreshold>;
326 };
327
328 using Descendants = std::tuple<
331
334
347#ifndef NO_DOC
348 template<
349 typename... Args,
350 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
351 typename std::enable_if<
352 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
353 value,
354 int>::type = 0>
355#else
356 template<typename... Args>
357#endif
358 explicit ConvergenceCriteria(Args &&...args)
359 {
360 using namespace Zivid::Detail::TypeTraits;
361
362 static_assert(
363 AllArgsDecayedAreUnique<Args...>::value,
364 "Found duplicate types among the arguments passed to ConvergenceCriteria(...). "
365 "Types should be listed at most once.");
366
367 set(std::forward<Args>(args)...);
368 }
369
381#ifndef NO_DOC
382 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
383#else
384 template<typename... Args>
385#endif
386 void set(Args &&...args)
387 {
388 using namespace Zivid::Detail::TypeTraits;
389
390 using AllArgsAreDescendantNodes =
391 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
392 static_assert(
393 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
394
395 static_assert(
396 AllArgsDecayedAreUnique<Args...>::value,
397 "Found duplicate types among the arguments passed to set(...). "
398 "Types should be listed at most once.");
399
400 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
401 }
402
415#ifndef NO_DOC
416 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
417#else
418 template<typename... Args>
419#endif
420 ConvergenceCriteria copyWith(Args &&...args) const
421 {
422 using namespace Zivid::Detail::TypeTraits;
423
424 using AllArgsAreDescendantNodes =
425 AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
426 static_assert(
427 AllArgsAreDescendantNodes::value,
428 "All arguments passed to copyWith(...) must be descendant nodes.");
429
430 static_assert(
431 AllArgsDecayedAreUnique<Args...>::value,
432 "Found duplicate types among the arguments passed to copyWith(...). "
433 "Types should be listed at most once.");
434
435 auto copy{ *this };
436 copy.set(std::forward<Args>(args)...);
437 return copy;
438 }
439
442 {
443 return m_rmseDiffThreshold;
444 }
445
448 {
449 return m_rmseDiffThreshold;
450 }
451
454 {
455 m_rmseDiffThreshold = value;
456 return *this;
457 }
458
461 {
462 return m_sourceCoverageDiffThreshold;
463 }
464
467 {
468 return m_sourceCoverageDiffThreshold;
469 }
470
473 {
474 m_sourceCoverageDiffThreshold = value;
475 return *this;
476 }
477
478 template<
479 typename T,
480 typename std::enable_if<
481 std::is_same<T, LocalPointCloudRegistrationParameters::ConvergenceCriteria::RMSEDiffThreshold>::
482 value,
483 int>::type = 0>
485 {
486 return m_rmseDiffThreshold;
487 }
488
489 template<
490 typename T,
491 typename std::enable_if<
492 std::is_same<
493 T,
495 value,
496 int>::type = 0>
498 const
499 {
500 return m_sourceCoverageDiffThreshold;
501 }
502
503 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
505 {
506 return m_rmseDiffThreshold;
507 }
508
509 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
511 const
512 {
513 return m_sourceCoverageDiffThreshold;
514 }
515
517 template<typename F>
518 void forEach(const F &f) const
519 {
520 f(m_rmseDiffThreshold);
521 f(m_sourceCoverageDiffThreshold);
522 }
523
525 template<typename F>
526 void forEach(const F &f)
527 {
528 f(m_rmseDiffThreshold);
529 f(m_sourceCoverageDiffThreshold);
530 }
531
533 bool operator==(const ConvergenceCriteria &other) const;
534
536 bool operator!=(const ConvergenceCriteria &other) const;
537
539 std::string toString() const;
540
542 friend std::ostream &operator<<(std::ostream &stream, const ConvergenceCriteria &value)
543 {
544 return stream << value.toString();
545 }
546
547 private:
548 void setFromString(const std::string &value);
549
550 void setFromString(const std::string &fullPath, const std::string &value);
551
552 std::string getString(const std::string &fullPath) const;
553
554 RMSEDiffThreshold m_rmseDiffThreshold;
555 SourceCoverageDiffThreshold m_sourceCoverageDiffThreshold;
556
557 friend struct DataModel::Detail::Befriend<ConvergenceCriteria>;
558 };
559
564
565 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
567 {
568 public:
570 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
571
573 static constexpr const char *path{ "MaxCorrespondenceDistance" };
574
576 static constexpr const char *name{ "MaxCorrespondenceDistance" };
577
579 static constexpr const char *description{
580 R"description(The radius around each source point in which the algorithm will look for neighbors in the target point cloud.
581Should be larger than the typical distance between points in the point clouds.
582This parameter may have a significant performance impact.
583)description"
584 };
585
587 using ValueType = float;
588
590 static constexpr Range<float> validRange()
591 {
592 return { std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max() };
593 }
594
597
599 explicit constexpr MaxCorrespondenceDistance(float value)
600 : m_value{ value }
601 {}
602
604 float value() const;
605
607 std::string toString() const;
608
610 bool operator==(const MaxCorrespondenceDistance &other) const
611 {
612 return m_value == other.m_value;
613 }
614
616 bool operator!=(const MaxCorrespondenceDistance &other) const
617 {
618 return m_value != other.m_value;
619 }
620
622 bool operator<(const MaxCorrespondenceDistance &other) const
623 {
624 return m_value < other.m_value;
625 }
626
628 bool operator>(const MaxCorrespondenceDistance &other) const
629 {
630 return m_value > other.m_value;
631 }
632
634 bool operator<=(const MaxCorrespondenceDistance &other) const
635 {
636 return m_value <= other.m_value;
637 }
638
640 bool operator>=(const MaxCorrespondenceDistance &other) const
641 {
642 return m_value >= other.m_value;
643 }
644
646 friend std::ostream &operator<<(std::ostream &stream, const MaxCorrespondenceDistance &value)
647 {
648 return stream << value.toString();
649 }
650
651 private:
652 void setFromString(const std::string &value);
653
654 float m_value{ 10.0F };
655
656 friend struct DataModel::Detail::Befriend<MaxCorrespondenceDistance>;
657 };
658
661
662 // NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
664 {
665 public:
667 static constexpr DataModel::NodeType nodeType = DataModel::NodeType::leafValue;
668
670 static constexpr const char *path{ "MaxIterationCount" };
671
673 static constexpr const char *name{ "MaxIterationCount" };
674
676 static constexpr const char *description{
677 R"description(End iteration when reaching this number, even if convergence criteria are not yet satisfied.
678)description"
679 };
680
682 using ValueType = uint32_t;
683
685 static constexpr Range<uint32_t> validRange()
686 {
687 return { std::numeric_limits<uint32_t>::lowest(), std::numeric_limits<uint32_t>::max() };
688 }
689
691 MaxIterationCount() = default;
692
694 explicit constexpr MaxIterationCount(uint32_t value)
695 : m_value{ value }
696 {}
697
699 uint32_t value() const;
700
702 std::string toString() const;
703
705 bool operator==(const MaxIterationCount &other) const
706 {
707 return m_value == other.m_value;
708 }
709
711 bool operator!=(const MaxIterationCount &other) const
712 {
713 return m_value != other.m_value;
714 }
715
717 bool operator<(const MaxIterationCount &other) const
718 {
719 return m_value < other.m_value;
720 }
721
723 bool operator>(const MaxIterationCount &other) const
724 {
725 return m_value > other.m_value;
726 }
727
729 bool operator<=(const MaxIterationCount &other) const
730 {
731 return m_value <= other.m_value;
732 }
733
735 bool operator>=(const MaxIterationCount &other) const
736 {
737 return m_value >= other.m_value;
738 }
739
741 friend std::ostream &operator<<(std::ostream &stream, const MaxIterationCount &value)
742 {
743 return stream << value.toString();
744 }
745
746 private:
747 void setFromString(const std::string &value);
748
749 uint32_t m_value{ 200 };
750
751 friend struct DataModel::Detail::Befriend<MaxIterationCount>;
752 };
753
754 using Descendants = std::tuple<
760
763
765 explicit LocalPointCloudRegistrationParameters(const std::string &fileName);
766
772 [[nodiscard]] static LocalPointCloudRegistrationParameters fromSerialized(const std::string &value);
773
779 std::string serialize() const;
780
796#ifndef NO_DOC
797 template<
798 typename... Args,
799 typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0,
800 typename std::enable_if<
801 Zivid::Detail::TypeTraits::AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>::
802 value,
803 int>::type = 0>
804#else
805 template<typename... Args>
806#endif
808 {
809 using namespace Zivid::Detail::TypeTraits;
810
811 static_assert(
812 AllArgsDecayedAreUnique<Args...>::value,
813 "Found duplicate types among the arguments passed to LocalPointCloudRegistrationParameters(...). "
814 "Types should be listed at most once.");
815
816 set(std::forward<Args>(args)...);
817 }
818
833#ifndef NO_DOC
834 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 2, int>::type = 0>
835#else
836 template<typename... Args>
837#endif
838 void set(Args &&...args)
839 {
840 using namespace Zivid::Detail::TypeTraits;
841
842 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
843 static_assert(
844 AllArgsAreDescendantNodes::value, "All arguments passed to set(...) must be descendant nodes.");
845
846 static_assert(
847 AllArgsDecayedAreUnique<Args...>::value,
848 "Found duplicate types among the arguments passed to set(...). "
849 "Types should be listed at most once.");
850
851 Zivid::DataModel::Detail::invokeSetWithEachArgument(*this, std::forward<Args>(args)...);
852 }
853
869#ifndef NO_DOC
870 template<typename... Args, typename std::enable_if<sizeof...(Args) >= 1, int>::type = 0>
871#else
872 template<typename... Args>
873#endif
875 {
876 using namespace Zivid::Detail::TypeTraits;
877
878 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
879 static_assert(
880 AllArgsAreDescendantNodes::value,
881 "All arguments passed to copyWith(...) must be descendant nodes.");
882
883 static_assert(
884 AllArgsDecayedAreUnique<Args...>::value,
885 "Found duplicate types among the arguments passed to copyWith(...). "
886 "Types should be listed at most once.");
887
888 auto copy{ *this };
889 copy.set(std::forward<Args>(args)...);
890 return copy;
891 }
892
895 {
896 return m_convergenceCriteria;
897 }
898
901 {
902 return m_convergenceCriteria;
903 }
904
907 {
908 m_convergenceCriteria = value;
909 return *this;
910 }
911
914 {
915 m_convergenceCriteria.set(value);
916 return *this;
917 }
918
921 {
922 m_convergenceCriteria.set(value);
923 return *this;
924 }
925
928 {
929 return m_maxCorrespondenceDistance;
930 }
931
934 {
935 return m_maxCorrespondenceDistance;
936 }
937
940 {
941 m_maxCorrespondenceDistance = value;
942 return *this;
943 }
944
947 {
948 return m_maxIterationCount;
949 }
950
953 {
954 return m_maxIterationCount;
955 }
956
959 {
960 m_maxIterationCount = value;
961 return *this;
962 }
963
964 template<
965 typename T,
966 typename std::enable_if<
967 std::is_same<T, LocalPointCloudRegistrationParameters::ConvergenceCriteria>::value,
968 int>::type = 0>
970 {
971 return m_convergenceCriteria;
972 }
973
974 template<
975 typename T,
976 typename std::enable_if<
977 std::is_same<T, LocalPointCloudRegistrationParameters::ConvergenceCriteria::RMSEDiffThreshold>::
978 value,
979 int>::type = 0>
981 {
982 return m_convergenceCriteria
984 }
985
986 template<
987 typename T,
988 typename std::enable_if<
989 std::is_same<
990 T,
992 int>::type = 0>
994 {
995 return m_convergenceCriteria
997 }
998
999 template<
1000 typename T,
1001 typename std::enable_if<
1002 std::is_same<T, LocalPointCloudRegistrationParameters::MaxCorrespondenceDistance>::value,
1003 int>::type = 0>
1005 {
1006 return m_maxCorrespondenceDistance;
1007 }
1008
1009 template<
1010 typename T,
1011 typename std::enable_if<
1012 std::is_same<T, LocalPointCloudRegistrationParameters::MaxIterationCount>::value,
1013 int>::type = 0>
1015 {
1016 return m_maxIterationCount;
1017 }
1018
1019 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1021 {
1022 return m_convergenceCriteria;
1023 }
1024
1025 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1027 {
1028 return m_maxCorrespondenceDistance;
1029 }
1030
1031 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
1033 {
1034 return m_maxIterationCount;
1035 }
1036
1038 template<typename F>
1039 void forEach(const F &f) const
1040 {
1041 f(m_convergenceCriteria);
1042 f(m_maxCorrespondenceDistance);
1043 f(m_maxIterationCount);
1044 }
1045
1047 template<typename F>
1048 void forEach(const F &f)
1049 {
1050 f(m_convergenceCriteria);
1051 f(m_maxCorrespondenceDistance);
1052 f(m_maxIterationCount);
1053 }
1054
1057
1060
1062 std::string toString() const;
1063
1065 friend std::ostream &operator<<(std::ostream &stream, const LocalPointCloudRegistrationParameters &value)
1066 {
1067 return stream << value.toString();
1068 }
1069
1071 void save(const std::string &fileName) const;
1072
1074 void load(const std::string &fileName);
1075
1076 private:
1077 void setFromString(const std::string &value);
1078
1079 void setFromString(const std::string &fullPath, const std::string &value);
1080
1081 std::string getString(const std::string &fullPath) const;
1082
1083 ConvergenceCriteria m_convergenceCriteria;
1084 MaxCorrespondenceDistance m_maxCorrespondenceDistance;
1085 MaxIterationCount m_maxIterationCount;
1086
1087 friend struct DataModel::Detail::Befriend<LocalPointCloudRegistrationParameters>;
1088 };
1089
1090#ifndef NO_DOC
1091 template<>
1092 struct LocalPointCloudRegistrationParameters::Version<1>
1093 {
1095 };
1096#endif
1097
1098 } // namespace Experimental
1099} // namespace Zivid
1100
1101#ifndef NO_DOC
1103namespace Zivid::Detail
1104{
1105
1106 ZIVID_CORE_EXPORT void save(
1108 std::ostream &ostream);
1109 ZIVID_CORE_EXPORT void load(
1111 std::istream &istream);
1112
1113 ZIVID_CORE_EXPORT std::vector<uint8_t> serializeToBinaryVector(
1115 ZIVID_CORE_EXPORT void deserializeFromBinaryVector(
1117 const std::vector<uint8_t> &data);
1118
1119} // namespace Zivid::Detail
1120#endif
1121
1122#ifdef _MSC_VER
1123# pragma warning(pop)
1124#endif
1125
1126#ifndef NO_DOC
1127# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
1128namespace std // NOLINT
1129{
1130
1131 template<>
1132 struct tuple_size<Zivid::Experimental::LocalPointCloudRegistrationParameters::ConvergenceCriteria>
1133 : integral_constant<size_t, 2>
1134 {};
1135
1136 template<size_t i>
1137 struct tuple_element<i, Zivid::Experimental::LocalPointCloudRegistrationParameters::ConvergenceCriteria>
1138 {
1139 static_assert(
1140 i < tuple_size<Zivid::Experimental::LocalPointCloudRegistrationParameters::ConvergenceCriteria>::value,
1141 "Index must be less than 2");
1142
1143 using type // NOLINT
1144 = decltype(declval<Zivid::Experimental::LocalPointCloudRegistrationParameters::ConvergenceCriteria>()
1145 .get<i>());
1146 };
1147
1148 template<>
1149 struct tuple_size<Zivid::Experimental::LocalPointCloudRegistrationParameters> : integral_constant<size_t, 3>
1150 {};
1151
1152 template<size_t i>
1153 struct tuple_element<i, Zivid::Experimental::LocalPointCloudRegistrationParameters>
1154 {
1155 static_assert(
1156 i < tuple_size<Zivid::Experimental::LocalPointCloudRegistrationParameters>::value,
1157 "Index must be less than 3");
1158
1159 using type // NOLINT
1160 = decltype(declval<Zivid::Experimental::LocalPointCloudRegistrationParameters>().get<i>());
1161 };
1162
1163} // namespace std
1164# endif
1165#endif
1166
1167// If we have access to the DataModel library, automatically include internal DataModel
1168// header. This header is necessary for serialization and deserialization.
1169#if defined(__has_include) && !defined(NO_DOC)
1170# if __has_include( \
1171 "Zivid/Experimental/LocalPointCloudRegistrationParametersInternal.h") \
1172 && __has_include("Zivid/DataModelNodeMetaData.h")
1173# include "Zivid/Experimental/LocalPointCloudRegistrationParametersInternal.h"
1174# endif
1175#endif
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Stop iteration when the absolute change in root mean square error (RMSE) from previous iteration is l...
Definition LocalPointCloudRegistrationParameters.h:140
bool operator>=(const RMSEDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:212
bool operator<(const RMSEDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:194
bool operator>(const RMSEDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:200
constexpr RMSEDiffThreshold(float value)
Constructor.
Definition LocalPointCloudRegistrationParameters.h:171
bool operator<=(const RMSEDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:206
static constexpr Range< float > validRange()
The range of valid values for RMSEDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:162
bool operator!=(const RMSEDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:188
float ValueType
The type of the underlying value.
Definition LocalPointCloudRegistrationParameters.h:159
bool operator==(const RMSEDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:182
friend std::ostream & operator<<(std::ostream &stream, const RMSEDiffThreshold &value)
Operator to serialize the value to a stream.
Definition LocalPointCloudRegistrationParameters.h:218
Stop iteration when the absolute change in coverage from previous iteration is less than this thresho...
Definition LocalPointCloudRegistrationParameters.h:237
friend std::ostream & operator<<(std::ostream &stream, const SourceCoverageDiffThreshold &value)
Operator to serialize the value to a stream.
Definition LocalPointCloudRegistrationParameters.h:315
bool operator>(const SourceCoverageDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:297
bool operator<=(const SourceCoverageDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:303
static constexpr Range< float > validRange()
The range of valid values for SourceCoverageDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:259
bool operator<(const SourceCoverageDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:291
bool operator>=(const SourceCoverageDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:309
bool operator!=(const SourceCoverageDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:285
bool operator==(const SourceCoverageDiffThreshold &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:279
float ValueType
The type of the underlying value.
Definition LocalPointCloudRegistrationParameters.h:256
constexpr SourceCoverageDiffThreshold(float value)
Constructor.
Definition LocalPointCloudRegistrationParameters.h:268
Criteria for ending iteration early. Iteration will end when all criteria are satisfied.
Definition LocalPointCloudRegistrationParameters.h:117
const LocalPointCloudRegistrationParameters::ConvergenceCriteria::SourceCoverageDiffThreshold & get() const
Definition LocalPointCloudRegistrationParameters.h:497
ConvergenceCriteria & set(const RMSEDiffThreshold &value)
Set RMSEDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:453
std::tuple< LocalPointCloudRegistrationParameters::ConvergenceCriteria::RMSEDiffThreshold, LocalPointCloudRegistrationParameters::ConvergenceCriteria::SourceCoverageDiffThreshold > Descendants
Definition LocalPointCloudRegistrationParameters.h:328
ConvergenceCriteria copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition LocalPointCloudRegistrationParameters.h:420
friend std::ostream & operator<<(std::ostream &stream, const ConvergenceCriteria &value)
Operator to send the value as string to a stream.
Definition LocalPointCloudRegistrationParameters.h:542
ConvergenceCriteria & set(const SourceCoverageDiffThreshold &value)
Set SourceCoverageDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:472
const SourceCoverageDiffThreshold & sourceCoverageDiffThreshold() const
Get SourceCoverageDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:460
bool operator!=(const ConvergenceCriteria &other) const
Inequality operator.
RMSEDiffThreshold & rmseDiffThreshold()
Get RMSEDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:447
const RMSEDiffThreshold & rmseDiffThreshold() const
Get RMSEDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:441
void set(Args &&...args)
Set multiple arguments.
Definition LocalPointCloudRegistrationParameters.h:386
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition LocalPointCloudRegistrationParameters.h:518
bool operator==(const ConvergenceCriteria &other) const
Equality operator.
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition LocalPointCloudRegistrationParameters.h:526
SourceCoverageDiffThreshold & sourceCoverageDiffThreshold()
Get SourceCoverageDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:466
const LocalPointCloudRegistrationParameters::ConvergenceCriteria::RMSEDiffThreshold & get() const
Definition LocalPointCloudRegistrationParameters.h:484
The radius around each source point in which the algorithm will look for neighbors in the target poin...
Definition LocalPointCloudRegistrationParameters.h:567
bool operator<(const MaxCorrespondenceDistance &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:622
constexpr MaxCorrespondenceDistance(float value)
Constructor.
Definition LocalPointCloudRegistrationParameters.h:599
friend std::ostream & operator<<(std::ostream &stream, const MaxCorrespondenceDistance &value)
Operator to serialize the value to a stream.
Definition LocalPointCloudRegistrationParameters.h:646
bool operator!=(const MaxCorrespondenceDistance &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:616
bool operator>=(const MaxCorrespondenceDistance &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:640
bool operator>(const MaxCorrespondenceDistance &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:628
bool operator<=(const MaxCorrespondenceDistance &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:634
static constexpr Range< float > validRange()
The range of valid values for MaxCorrespondenceDistance.
Definition LocalPointCloudRegistrationParameters.h:590
bool operator==(const MaxCorrespondenceDistance &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:610
float ValueType
The type of the underlying value.
Definition LocalPointCloudRegistrationParameters.h:587
End iteration when reaching this number, even if convergence criteria are not yet satisfied.
Definition LocalPointCloudRegistrationParameters.h:664
bool operator>(const MaxIterationCount &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:723
bool operator==(const MaxIterationCount &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:705
bool operator>=(const MaxIterationCount &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:735
uint32_t ValueType
The type of the underlying value.
Definition LocalPointCloudRegistrationParameters.h:682
friend std::ostream & operator<<(std::ostream &stream, const MaxIterationCount &value)
Operator to serialize the value to a stream.
Definition LocalPointCloudRegistrationParameters.h:741
bool operator!=(const MaxIterationCount &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:711
bool operator<=(const MaxIterationCount &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:729
static constexpr Range< uint32_t > validRange()
The range of valid values for MaxIterationCount.
Definition LocalPointCloudRegistrationParameters.h:685
constexpr MaxIterationCount(uint32_t value)
Constructor.
Definition LocalPointCloudRegistrationParameters.h:694
bool operator<(const MaxIterationCount &other) const
Comparison operator.
Definition LocalPointCloudRegistrationParameters.h:717
Input parameters for controlling the local point cloud registration process.
Definition LocalPointCloudRegistrationParameters.h:81
std::string toString() const
Get the value as string.
LocalPointCloudRegistrationParameters & set(const MaxCorrespondenceDistance &value)
Set MaxCorrespondenceDistance.
Definition LocalPointCloudRegistrationParameters.h:939
const LocalPointCloudRegistrationParameters::ConvergenceCriteria::SourceCoverageDiffThreshold & get() const
Definition LocalPointCloudRegistrationParameters.h:993
const LocalPointCloudRegistrationParameters::ConvergenceCriteria & get() const
Definition LocalPointCloudRegistrationParameters.h:969
MaxCorrespondenceDistance & maxCorrespondenceDistance()
Get MaxCorrespondenceDistance.
Definition LocalPointCloudRegistrationParameters.h:933
const MaxIterationCount & maxIterationCount() const
Get MaxIterationCount.
Definition LocalPointCloudRegistrationParameters.h:946
const LocalPointCloudRegistrationParameters::MaxIterationCount & get() const
Definition LocalPointCloudRegistrationParameters.h:1014
bool operator==(const LocalPointCloudRegistrationParameters &other) const
Equality operator.
ConvergenceCriteria & convergenceCriteria()
Get ConvergenceCriteria.
Definition LocalPointCloudRegistrationParameters.h:900
bool operator!=(const LocalPointCloudRegistrationParameters &other) const
Inequality operator.
const ConvergenceCriteria & convergenceCriteria() const
Get ConvergenceCriteria.
Definition LocalPointCloudRegistrationParameters.h:894
void set(Args &&...args)
Set multiple arguments.
Definition LocalPointCloudRegistrationParameters.h:838
const MaxCorrespondenceDistance & maxCorrespondenceDistance() const
Get MaxCorrespondenceDistance.
Definition LocalPointCloudRegistrationParameters.h:927
friend std::ostream & operator<<(std::ostream &stream, const LocalPointCloudRegistrationParameters &value)
Operator to send the value as string to a stream.
Definition LocalPointCloudRegistrationParameters.h:1065
const LocalPointCloudRegistrationParameters::ConvergenceCriteria::RMSEDiffThreshold & get() const
Definition LocalPointCloudRegistrationParameters.h:980
LocalPointCloudRegistrationParameters & set(const MaxIterationCount &value)
Set MaxIterationCount.
Definition LocalPointCloudRegistrationParameters.h:958
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition LocalPointCloudRegistrationParameters.h:1048
static LocalPointCloudRegistrationParameters fromSerialized(const std::string &value)
Construct a new LocalPointCloudRegistrationParameters instance from a previously serialized string.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition LocalPointCloudRegistrationParameters.h:1039
std::tuple< LocalPointCloudRegistrationParameters::ConvergenceCriteria, LocalPointCloudRegistrationParameters::ConvergenceCriteria::RMSEDiffThreshold, LocalPointCloudRegistrationParameters::ConvergenceCriteria::SourceCoverageDiffThreshold, LocalPointCloudRegistrationParameters::MaxCorrespondenceDistance, LocalPointCloudRegistrationParameters::MaxIterationCount > Descendants
Definition LocalPointCloudRegistrationParameters.h:754
LocalPointCloudRegistrationParameters copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition LocalPointCloudRegistrationParameters.h:874
void save(const std::string &fileName) const
Save to the given file.
void load(const std::string &fileName)
Load from the given file.
std::string serialize() const
Serialize to a string.
MaxIterationCount & maxIterationCount()
Get MaxIterationCount.
Definition LocalPointCloudRegistrationParameters.h:952
LocalPointCloudRegistrationParameters(const std::string &fileName)
Construct LocalPointCloudRegistrationParameters by loading from file.
LocalPointCloudRegistrationParameters & set(const ConvergenceCriteria::SourceCoverageDiffThreshold &value)
Set ConvergenceCriteria::SourceCoverageDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:920
LocalPointCloudRegistrationParameters & set(const ConvergenceCriteria &value)
Set ConvergenceCriteria.
Definition LocalPointCloudRegistrationParameters.h:906
const LocalPointCloudRegistrationParameters::MaxCorrespondenceDistance & get() const
Definition LocalPointCloudRegistrationParameters.h:1004
LocalPointCloudRegistrationParameters & set(const ConvergenceCriteria::RMSEDiffThreshold &value)
Set ConvergenceCriteria::RMSEDiffThreshold.
Definition LocalPointCloudRegistrationParameters.h:913
Class describing a range of values for a given type T.
Definition Range.h:75
NodeType
Definition NodeType.h:49
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84