61 # pragma warning(push)
62 # pragma warning(disable : 4251) // "X needs to have dll-interface to be used by clients of class Y."
71 static constexpr
size_t version{ 3 };
84 Settings(
const Settings &other);
87 Settings &operator=(
const Settings &other);
90 Settings(Settings &&other) noexcept;
93 Settings &operator=(Settings &&other) noexcept;
99 static constexpr
bool isContainer{
true };
102 static constexpr
const char *path{
"" };
105 static constexpr
const char *name{
"Settings" };
108 static constexpr
const char *description{ R
"description(Settings for a Zivid camera)description" };
111 void set(
const std::string &fullPath,
const std::string &value);
114 std::string getString(
const std::string &fullPath)
const;
121 using ValueType = bool;
122 static const Bidirectional yes;
123 static const Bidirectional no;
126 static constexpr
bool isContainer{
false };
129 static constexpr
const char *path{
"Bidirectional" };
132 static constexpr
const char *name{
"Bidirectional" };
135 static constexpr
const char *description{
136 R
"description(Enable or disable the use of bi-directional patterns (requires twice as many patterns as well as increased exposure time))description"
140 Bidirectional() = default;
143 explicit constexpr Bidirectional(ValueType value) noexcept(
144 std::is_nothrow_copy_constructible<ValueType>::value)
149 const ValueType &value()
const
155 void setFromString(
const std::string &value)
161 else if(value ==
"no")
167 throw std::invalid_argument(
"Bidirectional{ " + value +
" } is not in range [yes, no]");
174 return m_value ?
"yes" :
"no";
178 explicit operator bool()
const
186 return m_value == other.m_value;
190 bool operator!=(
const Bidirectional &other)
const
192 return m_value != other.m_value;
205 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
221 static constexpr
bool isContainer{
false };
224 static constexpr
const char *path{
"BlueBalance" };
227 static constexpr
const char *name{
"BlueBalance" };
230 static constexpr
const char *description{
231 R
"description(White balance of blue channel in the camera)description"
238 explicit constexpr
BlueBalance(ValueType value) noexcept(
239 std::is_nothrow_copy_constructible<ValueType>::value)
244 const ValueType &value()
const
250 Range<ValueType> range()
const
256 void setFromString(
const std::string &value)
258 m_value = std::stod(value);
264 return std::to_string(m_value);
270 return m_value == other.m_value;
276 return m_value != other.m_value;
282 return m_value < other.m_value;
288 return m_value > other.m_value;
292 friend std::ostream &
operator<<(std::ostream &stream,
const BlueBalance &value)
294 return stream << value.toString();
298 friend std::istream &operator>>(std::istream &stream,
BlueBalance &value)
301 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
328 using ValueType = double;
331 static constexpr
bool isContainer{
false };
334 static constexpr
const char *path{
"Brightness" };
337 static constexpr
const char *name{
"Brightness" };
340 static constexpr
const char *description{
341 R
"description(Brightness controls the light output from the projector.
343 Brightness above 1.0 may be needed when the distance between the camera and the
344 scene is large, or in case of high levels of ambient lighting. Brightness above 1.0
345 is only supported on Zivid One Plus.
347 When brightness is above 1.0 some limitations apply:
349 1) Live mode is not supported.
351 2) The duty cycle of the camera (the percentage of time the camera can capture frames) will be reduced.
352 The lights in the projector can be lit for at most 50% of the time during a 10 second period. This limitation
353 is enforced automatically by the camera. Calling capture when the duty cycle limit has been reached will cause
354 the camera to first wait (sleep) for a duration of time to cool down, before capture will start.
363 std::is_nothrow_copy_constructible<ValueType>::value)
368 const ValueType &value()
const
380 void setFromString(
const std::string &value)
382 m_value = std::stod(value);
388 return std::to_string(m_value);
392 bool operator==(
const Brightness &other)
const
394 return m_value == other.m_value;
398 bool operator!=(
const Brightness &other)
const
400 return m_value != other.m_value;
404 bool operator<(
const Brightness &other)
const
406 return m_value < other.m_value;
412 return m_value > other.m_value;
422 friend std::istream &operator>>(std::istream &stream,
Brightness &value)
425 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
430 ValueType m_value{ 1 };
438 using ValueType = std::chrono::microseconds;
441 static constexpr
bool isContainer{
false };
444 static constexpr
const char *path{
"ExposureTime" };
447 static constexpr
const char *name{
"ExposureTime" };
450 static constexpr
const char *description{
451 R
"description(Exposure time for each single image in the measurement. Affects frame rate.)description"
459 std::is_nothrow_copy_constructible<ValueType>::value)
464 const ValueType &value()
const
476 void setFromString(
const std::string &value)
478 m_value =
ValueType{ std::stoll(value) };
484 return std::to_string(m_value.count());
490 return m_value == other.m_value;
496 return m_value != other.m_value;
502 return m_value < other.m_value;
508 return m_value > other.m_value;
512 friend std::ostream &
operator<<(std::ostream &stream,
const ExposureTime &value)
514 return stream << value.toString();
518 friend std::istream &operator>>(std::istream &stream,
ExposureTime &value)
521 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
537 static constexpr
bool isContainer{
true };
540 static constexpr
const char *path{
"Filters" };
543 static constexpr
const char *name{
"Filters" };
546 static constexpr
const char *description{ R
"description(Collection of filters)description" };
549 void set(
const std::string &fullPath,
const std::string &value);
552 std::string getString(
const std::string &fullPath)
const;
559 Contrast() =
default;
562 static constexpr
bool isContainer{
true };
565 static constexpr
const char *path{
"Filters/Contrast" };
568 static constexpr
const char *name{
"Contrast" };
571 static constexpr
const char *description{
572 R
"description(Discard points with contrast values below a threshold)description"
576 void set(
const std::string &fullPath,
const std::string &value);
579 std::string getString(
const std::string &fullPath)
const;
587 static const Enabled yes;
588 static const Enabled no;
591 static constexpr
bool isContainer{
false };
594 static constexpr
const char *path{
"Filters/Contrast/Enabled" };
597 static constexpr
const char *name{
"Enabled" };
600 static constexpr
const char *description{
601 R
"description(Enable or disable the contrast filter)description"
608 explicit constexpr Enabled(ValueType value) noexcept(
609 std::is_nothrow_copy_constructible<ValueType>::value)
614 const ValueType &value()
const
620 void setFromString(
const std::string &value)
626 else if(value ==
"no")
632 throw std::invalid_argument(
"Enabled{ " + value +
" } is not in range [yes, no]");
639 return m_value ?
"yes" :
"no";
643 explicit operator bool()
const
649 bool operator==(
const Enabled &other)
const
651 return m_value == other.m_value;
655 bool operator!=(
const Enabled &other)
const
657 return m_value != other.m_value;
667 friend std::istream &operator>>(std::istream &stream,
Enabled &value)
670 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
686 static constexpr
bool isContainer{
false };
689 static constexpr
const char *path{
"Filters/Contrast/Threshold" };
692 static constexpr
const char *name{
"Threshold" };
695 static constexpr
const char *description{
696 R
"description(Discard points with contrast below the given value)description"
703 explicit constexpr
Threshold(ValueType value) noexcept(
704 std::is_nothrow_copy_constructible<ValueType>::value)
709 const ValueType &value()
const
717 return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
721 void setFromString(
const std::string &value)
723 m_value = std::stod(value);
729 return std::to_string(m_value);
733 bool operator==(
const Threshold &other)
const
735 return m_value == other.m_value;
739 bool operator!=(
const Threshold &other)
const
741 return m_value != other.m_value;
745 bool operator<(
const Threshold &other)
const
747 return m_value < other.m_value;
751 bool operator>(
const Threshold &other)
const
753 return m_value > other.m_value;
757 friend std::ostream &
operator<<(std::ostream &stream,
const Threshold &value)
759 return stream << value.toString();
763 friend std::istream &operator>>(std::istream &stream,
Threshold &value)
766 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
775 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Enabled>::value,
783 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Threshold>::value,
790 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
796 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
816 const Enabled &isEnabled()
const
830 throw std::out_of_range(
"Threshold{ " + std::to_string(value.
value()) +
" } is not in range ["
831 + std::to_string(value.
range().min()) +
", "
832 + std::to_string(value.
range().max()) +
"]");
846 void forEach(
const F &f)
const
854 void forEach(
const F &f)
862 void traverseValues(
const F &f)
const
870 void traverseValues(
const F &f)
886 void setFromString(
const std::string &value);
889 friend std::istream &operator>>(std::istream &stream,
Contrast &value)
892 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
897 bool operator==(
const Contrast &other)
const;
900 bool operator!=(
const Contrast &other)
const;
911 static constexpr
bool isContainer{
true };
914 static constexpr
const char *path{
"Filters/Gaussian" };
917 static constexpr
const char *name{
"Gaussian" };
920 static constexpr
const char *description{
921 R
"description(Gaussian smoothing of the point cloud)description"
925 void set(
const std::string &fullPath,
const std::string &value);
928 std::string getString(
const std::string &fullPath)
const;
935 using ValueType = bool;
940 static constexpr
bool isContainer{
false };
943 static constexpr
const char *path{
"Filters/Gaussian/Enabled" };
946 static constexpr
const char *name{
"Enabled" };
949 static constexpr
const char *description{
950 R
"description(Enable or disable the smoothing filter)description"
957 explicit constexpr Enabled(ValueType value) noexcept(
958 std::is_nothrow_copy_constructible<ValueType>::value)
963 const ValueType &value()
const
969 void setFromString(
const std::string &value)
975 else if(value ==
"no")
981 throw std::invalid_argument(
"Enabled{ " + value +
" } is not in range [yes, no]");
988 return m_value ?
"yes" :
"no";
992 explicit operator bool()
const
998 bool operator==(
const Enabled &other)
const
1000 return m_value == other.m_value;
1004 bool operator!=(
const Enabled &other)
const
1006 return m_value != other.m_value;
1016 friend std::istream &operator>>(std::istream &stream,
Enabled &value)
1019 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1035 static constexpr
bool isContainer{
false };
1038 static constexpr
const char *path{
"Filters/Gaussian/Sigma" };
1041 static constexpr
const char *name{
"Sigma" };
1044 static constexpr
const char *description{
1045 R
"description(Higher values result in smoother point clouds (Standard deviation of the filter coefficients))description"
1052 explicit constexpr
Sigma(ValueType value) noexcept(
1053 std::is_nothrow_copy_constructible<ValueType>::value)
1058 const ValueType &value()
const
1070 void setFromString(
const std::string &value)
1072 m_value = std::stod(value);
1078 return std::to_string(m_value);
1082 bool operator==(
const Sigma &other)
const
1084 return m_value == other.m_value;
1088 bool operator!=(
const Sigma &other)
const
1090 return m_value != other.m_value;
1094 bool operator<(
const Sigma &other)
const
1096 return m_value < other.m_value;
1100 bool operator>(
const Sigma &other)
const
1102 return m_value > other.m_value;
1106 friend std::ostream &
operator<<(std::ostream &stream,
const Sigma &value)
1108 return stream << value.toString();
1112 friend std::istream &operator>>(std::istream &stream,
Sigma &value)
1115 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1123 template<
typename T,
1124 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Enabled>::value,
1133 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Sigma>::value,
int>::type = 0>
1139 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1145 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1165 const Enabled &isEnabled()
const
1179 throw std::out_of_range(
"Sigma{ " + std::to_string(value.
value()) +
" } is not in range ["
1180 + std::to_string(value.
range().min()) +
", "
1181 + std::to_string(value.
range().max()) +
"]");
1188 const Sigma &sigma()
const
1194 template<
typename F>
1195 void forEach(
const F &f)
const
1202 template<
typename F>
1203 void forEach(
const F &f)
1210 template<
typename F>
1211 void traverseValues(
const F &f)
const
1218 template<
typename F>
1219 void traverseValues(
const F &f)
1235 void setFromString(
const std::string &value);
1238 friend std::istream &operator>>(std::istream &stream,
Gaussian &value)
1241 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1246 bool operator==(
const Gaussian &other)
const;
1249 bool operator!=(
const Gaussian &other)
const;
1260 static constexpr
bool isContainer{
true };
1263 static constexpr
const char *path{
"Filters/Outlier" };
1266 static constexpr
const char *name{
"Outlier" };
1269 static constexpr
const char *description{
1270 R
"description(Discard point if Euclidean distance to neighboring points is above a threshold)description"
1274 void set(
const std::string &fullPath,
const std::string &value);
1277 std::string getString(
const std::string &fullPath)
const;
1284 using ValueType = bool;
1289 static constexpr
bool isContainer{
false };
1292 static constexpr
const char *path{
"Filters/Outlier/Enabled" };
1295 static constexpr
const char *name{
"Enabled" };
1298 static constexpr
const char *description{
1299 R
"description(Enable or disable the outlier filter)description"
1303 Enabled() = default;
1306 explicit constexpr Enabled(ValueType value) noexcept(
1307 std::is_nothrow_copy_constructible<ValueType>::value)
1312 const ValueType &value()
const
1318 void setFromString(
const std::string &value)
1324 else if(value ==
"no")
1330 throw std::invalid_argument(
"Enabled{ " + value +
" } is not in range [yes, no]");
1337 return m_value ?
"yes" :
"no";
1341 explicit operator bool()
const
1347 bool operator==(
const Enabled &other)
const
1349 return m_value == other.m_value;
1353 bool operator!=(
const Enabled &other)
const
1355 return m_value != other.m_value;
1365 friend std::istream &operator>>(std::istream &stream,
Enabled &value)
1368 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1384 static constexpr
bool isContainer{
false };
1387 static constexpr
const char *path{
"Filters/Outlier/Threshold" };
1390 static constexpr
const char *name{
"Threshold" };
1393 static constexpr
const char *description{
1394 R
"description(Discard point if Euclidean distance to neighboring points is above the given value)description"
1401 explicit constexpr
Threshold(ValueType value) noexcept(
1402 std::is_nothrow_copy_constructible<ValueType>::value)
1407 const ValueType &value()
const
1415 return { std::numeric_limits<ValueType>::lowest(), std::numeric_limits<ValueType>::max() };
1419 void setFromString(
const std::string &value)
1421 m_value = std::stod(value);
1427 return std::to_string(m_value);
1431 bool operator==(
const Threshold &other)
const
1433 return m_value == other.m_value;
1437 bool operator!=(
const Threshold &other)
const
1439 return m_value != other.m_value;
1443 bool operator<(
const Threshold &other)
const
1445 return m_value < other.m_value;
1449 bool operator>(
const Threshold &other)
const
1451 return m_value > other.m_value;
1455 friend std::ostream &
operator<<(std::ostream &stream,
const Threshold &value)
1457 return stream << value.toString();
1461 friend std::istream &operator>>(std::istream &stream,
Threshold &value)
1464 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1474 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Enabled>::value,
int>::type = 0>
1480 template<
typename T,
1481 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Threshold>::value,
1488 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1494 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
1514 const Enabled &isEnabled()
const
1528 throw std::out_of_range(
"Threshold{ " + std::to_string(value.
value()) +
" } is not in range ["
1529 + std::to_string(value.
range().min()) +
", "
1530 + std::to_string(value.
range().max()) +
"]");
1533 m_threshold = value;
1543 template<
typename F>
1544 void forEach(
const F &f)
const
1551 template<
typename F>
1552 void forEach(
const F &f)
1559 template<
typename F>
1560 void traverseValues(
const F &f)
const
1567 template<
typename F>
1568 void traverseValues(
const F &f)
1584 void setFromString(
const std::string &value);
1587 friend std::istream &operator>>(std::istream &stream,
Outlier &value)
1590 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1595 bool operator==(
const Outlier &other)
const;
1598 bool operator!=(
const Outlier &other)
const;
1609 static constexpr
bool isContainer{
true };
1612 static constexpr
const char *path{
"Filters/Reflection" };
1615 static constexpr
const char *name{
"Reflection" };
1618 static constexpr
const char *description{
1619 R
"description(Discard points likely introduced by reflections (useful for shiny materials))description"
1623 void set(
const std::string &fullPath,
const std::string &value);
1626 std::string getString(
const std::string &fullPath)
const;
1633 using ValueType = bool;
1638 static constexpr
bool isContainer{
false };
1641 static constexpr
const char *path{
"Filters/Reflection/Enabled" };
1644 static constexpr
const char *name{
"Enabled" };
1647 static constexpr
const char *description{
1648 R
"description(Enable or disable the reflection filter. Note that this filter is computationally intensive and may affect the frame rate)description"
1652 Enabled() = default;
1655 explicit constexpr Enabled(ValueType value) noexcept(
1656 std::is_nothrow_copy_constructible<ValueType>::value)
1661 const ValueType &value()
const
1667 void setFromString(
const std::string &value)
1673 else if(value ==
"no")
1679 throw std::invalid_argument(
"Enabled{ " + value +
" } is not in range [yes, no]");
1686 return m_value ?
"yes" :
"no";
1690 explicit operator bool()
const
1696 bool operator==(
const Enabled &other)
const
1698 return m_value == other.m_value;
1702 bool operator!=(
const Enabled &other)
const
1704 return m_value != other.m_value;
1714 friend std::istream &operator>>(std::istream &stream,
Enabled &value)
1717 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1725 template<
typename T,
1726 typename std::enable_if<std::is_same<T, Settings::Filters::Reflection::Enabled>::value,
1733 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1753 const Enabled &isEnabled()
const
1759 template<
typename F>
1760 void forEach(
const F &f)
const
1766 template<
typename F>
1767 void forEach(
const F &f)
1773 template<
typename F>
1774 void traverseValues(
const F &f)
const
1780 template<
typename F>
1781 void traverseValues(
const F &f)
1796 void setFromString(
const std::string &value);
1799 friend std::istream &operator>>(std::istream &stream,
Reflection &value)
1802 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1810 bool operator!=(
const Reflection &other)
const;
1821 static constexpr
bool isContainer{
true };
1824 static constexpr
const char *path{
"Filters/Saturated" };
1827 static constexpr
const char *name{
"Saturated" };
1830 static constexpr
const char *description{
1831 R
"description(Discard points that are saturated)description"
1835 void set(
const std::string &fullPath,
const std::string &value);
1838 std::string getString(
const std::string &fullPath)
const;
1845 using ValueType = bool;
1850 static constexpr
bool isContainer{
false };
1853 static constexpr
const char *path{
"Filters/Saturated/Enabled" };
1856 static constexpr
const char *name{
"Enabled" };
1859 static constexpr
const char *description{
1860 R
"description(Enable or disable the saturation filter)description"
1864 Enabled() = default;
1867 explicit constexpr Enabled(ValueType value) noexcept(
1868 std::is_nothrow_copy_constructible<ValueType>::value)
1873 const ValueType &value()
const
1879 void setFromString(
const std::string &value)
1885 else if(value ==
"no")
1891 throw std::invalid_argument(
"Enabled{ " + value +
" } is not in range [yes, no]");
1898 return m_value ?
"yes" :
"no";
1902 explicit operator bool()
const
1908 bool operator==(
const Enabled &other)
const
1910 return m_value == other.m_value;
1914 bool operator!=(
const Enabled &other)
const
1916 return m_value != other.m_value;
1926 friend std::istream &operator>>(std::istream &stream,
Enabled &value)
1929 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
1937 template<
typename T,
1938 typename std::enable_if<std::is_same<T, Settings::Filters::Saturated::Enabled>::value,
1945 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
1965 const Enabled &isEnabled()
const
1971 template<
typename F>
1972 void forEach(
const F &f)
const
1978 template<
typename F>
1979 void forEach(
const F &f)
1985 template<
typename F>
1986 void traverseValues(
const F &f)
const
1992 template<
typename F>
1993 void traverseValues(
const F &f)
2008 void setFromString(
const std::string &value);
2011 friend std::istream &operator>>(std::istream &stream,
Saturated &value)
2014 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2022 bool operator!=(
const Saturated &other)
const;
2025 template<
typename T,
2026 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast>::value,
int>::type = 0>
2034 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Enabled>::value,
int>::type = 0>
2042 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Threshold>::value,
int>::type = 0>
2048 template<
typename T,
2049 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian>::value,
int>::type = 0>
2057 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Enabled>::value,
int>::type = 0>
2063 template<
typename T,
2064 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Sigma>::value,
int>::type = 0>
2070 template<
typename T,
2071 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier>::value,
int>::type = 0>
2079 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Enabled>::value,
int>::type = 0>
2087 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Threshold>::value,
int>::type = 0>
2093 template<
typename T,
2094 typename std::enable_if<std::is_same<T, Settings::Filters::Reflection>::value,
int>::type = 0>
2097 return m_reflection;
2102 typename std::enable_if<std::is_same<T, Settings::Filters::Reflection::Enabled>::value,
int>::type = 0>
2108 template<
typename T,
2109 typename std::enable_if<std::is_same<T, Settings::Filters::Saturated>::value,
int>::type = 0>
2117 typename std::enable_if<std::is_same<T, Settings::Filters::Saturated::Enabled>::value,
int>::type = 0>
2123 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2129 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2135 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
2141 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
2144 return m_reflection;
2147 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
2154 explicit Filters(
const Contrast &contrast,
2155 const Gaussian &gaussian,
2156 const Outlier &outlier,
2157 const Reflection &reflection,
2158 const Saturated &saturated);
2165 Filters &set(
const Contrast &value)
2171 const Contrast &contrast()
const
2177 Filters &set(
const Contrast::Enabled &value)
2179 m_contrast.
set(value);
2186 m_contrast.
set(value);
2195 Filters &set(
const Gaussian &value)
2201 const Gaussian &gaussian()
const
2207 Filters &set(
const Gaussian::Enabled &value)
2214 Filters &set(
const Gaussian::Sigma &value)
2216 m_gaussian.
set(value);
2225 Filters &set(
const Outlier &value)
2231 const Outlier &outlier()
const
2237 Filters &set(
const Outlier::Enabled &value)
2239 m_outlier.
set(value);
2246 m_outlier.
set(value);
2255 Filters &set(
const Reflection &value)
2257 m_reflection = value;
2261 const Reflection &reflection()
const
2263 return m_reflection;
2267 Filters &set(
const Reflection::Enabled &value)
2269 m_reflection.
set(value);
2278 Filters &set(
const Saturated &value)
2280 m_saturated = value;
2284 const Saturated &saturated()
const
2290 Filters &set(
const Saturated::Enabled &value)
2292 m_saturated.
set(value);
2297 template<
typename F>
2298 void forEach(
const F &f)
const
2308 template<
typename F>
2309 void forEach(
const F &f)
2319 template<
typename F>
2320 void traverseValues(
const F &f)
const
2322 m_contrast.traverseValues(f);
2323 m_gaussian.traverseValues(f);
2324 m_outlier.traverseValues(f);
2325 m_reflection.traverseValues(f);
2326 m_saturated.traverseValues(f);
2330 template<
typename F>
2331 void traverseValues(
const F &f)
2333 m_contrast.traverseValues(f);
2334 m_gaussian.traverseValues(f);
2335 m_outlier.traverseValues(f);
2336 m_reflection.traverseValues(f);
2337 m_saturated.traverseValues(f);
2350 void setFromString(
const std::string &value);
2353 friend std::istream &operator>>(std::istream &stream,
Filters &value)
2356 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2361 bool operator==(
const Filters &other)
const;
2364 bool operator!=(
const Filters &other)
const;
2372 using ValueType = double;
2375 static constexpr
bool isContainer{
false };
2378 static constexpr
const char *path{
"Gain" };
2381 static constexpr
const char *name{
"Gain" };
2384 static constexpr
const char *description{ R
"description(Analog gain in the camera)description" };
2390 explicit constexpr
Gain(ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
2395 const ValueType &value()
const
2407 void setFromString(
const std::string &value)
2409 m_value = std::stod(value);
2415 return std::to_string(m_value);
2419 bool operator==(
const Gain &other)
const
2421 return m_value == other.m_value;
2425 bool operator!=(
const Gain &other)
const
2427 return m_value != other.m_value;
2431 bool operator<(
const Gain &other)
const
2433 return m_value < other.m_value;
2437 bool operator>(
const Gain &other)
const
2439 return m_value > other.m_value;
2443 friend std::ostream &
operator<<(std::ostream &stream,
const Gain &value)
2445 return stream << value.toString();
2449 friend std::istream &operator>>(std::istream &stream,
Gain &value)
2452 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2468 static constexpr
bool isContainer{
false };
2471 static constexpr
const char *path{
"Iris" };
2474 static constexpr
const char *name{
"Iris" };
2477 static constexpr
const char *description{
2478 R
"description(Iris (aperture) setting for the camera)description"
2485 explicit constexpr
Iris(
ValueType value) noexcept(std::is_nothrow_copy_constructible<ValueType>::value)
2490 const ValueType &value()
const
2502 void setFromString(
const std::string &value)
2504 m_value = std::stoull(value);
2510 return std::to_string(m_value);
2514 bool operator==(
const Iris &other)
const
2516 return m_value == other.m_value;
2520 bool operator!=(
const Iris &other)
const
2522 return m_value != other.m_value;
2526 bool operator<(
const Iris &other)
const
2528 return m_value < other.m_value;
2532 bool operator>(
const Iris &other)
const
2534 return m_value > other.m_value;
2538 friend std::ostream &
operator<<(std::ostream &stream,
const Iris &value)
2540 return stream << value.toString();
2544 friend std::istream &operator>>(std::istream &stream,
Iris &value)
2547 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2563 static constexpr
bool isContainer{
false };
2566 static constexpr
const char *path{
"RedBalance" };
2569 static constexpr
const char *name{
"RedBalance" };
2572 static constexpr
const char *description{
2573 R
"description(White balance of red channel in the camera)description"
2581 std::is_nothrow_copy_constructible<ValueType>::value)
2586 const ValueType &value()
const
2594 return { 1.0, 8.0 };
2598 void setFromString(
const std::string &value)
2600 m_value = std::stod(value);
2606 return std::to_string(m_value);
2610 bool operator==(
const RedBalance &other)
const
2612 return m_value == other.m_value;
2616 bool operator!=(
const RedBalance &other)
const
2618 return m_value != other.m_value;
2622 bool operator<(
const RedBalance &other)
const
2624 return m_value < other.m_value;
2628 bool operator>(
const RedBalance &other)
const
2630 return m_value > other.m_value;
2634 friend std::ostream &
operator<<(std::ostream &stream,
const RedBalance &value)
2636 return stream << value.toString();
2640 friend std::istream &operator>>(std::istream &stream,
RedBalance &value)
2643 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
2651 template<typename T, typename std::enable_if<std::is_same<T, Settings::Bidirectional>::value,
int>::type = 0>
2654 return m_bidirectional;
2657 template<typename T, typename std::enable_if<std::is_same<T, Settings::BlueBalance>::value,
int>::type = 0>
2660 return m_blueBalance;
2663 template<typename T, typename std::enable_if<std::is_same<T, Settings::Brightness>::value,
int>::type = 0>
2666 return m_brightness;
2669 template<typename T, typename std::enable_if<std::is_same<T, Settings::ExposureTime>::value,
int>::type = 0>
2672 return m_exposureTime;
2675 template<typename T, typename std::enable_if<std::is_same<T, Settings::Filters>::value,
int>::type = 0>
2681 template<
typename T,
2682 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast>::value,
int>::type = 0>
2688 template<
typename T,
2689 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Enabled>::value,
int>::type = 0>
2695 template<
typename T,
2696 typename std::enable_if<std::is_same<T, Settings::Filters::Contrast::Threshold>::value,
int>::type = 0>
2702 template<
typename T,
2703 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian>::value,
int>::type = 0>
2709 template<
typename T,
2710 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Enabled>::value,
int>::type = 0>
2716 template<
typename T,
2717 typename std::enable_if<std::is_same<T, Settings::Filters::Gaussian::Sigma>::value,
int>::type = 0>
2723 template<typename T, typename std::enable_if<std::is_same<T, Settings::Filters::Outlier>::value,
int>::type = 0>
2729 template<
typename T,
2730 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Enabled>::value,
int>::type = 0>
2736 template<
typename T,
2737 typename std::enable_if<std::is_same<T, Settings::Filters::Outlier::Threshold>::value,
int>::type = 0>
2743 template<
typename T,
2744 typename std::enable_if<std::is_same<T, Settings::Filters::Reflection>::value,
int>::type = 0>
2750 template<
typename T,
2751 typename std::enable_if<std::is_same<T, Settings::Filters::Reflection::Enabled>::value,
int>::type = 0>
2757 template<
typename T,
2758 typename std::enable_if<std::is_same<T, Settings::Filters::Saturated>::value,
int>::type = 0>
2764 template<
typename T,
2765 typename std::enable_if<std::is_same<T, Settings::Filters::Saturated::Enabled>::value,
int>::type = 0>
2771 template<typename T, typename std::enable_if<std::is_same<T, Settings::Gain>::value,
int>::type = 0>
2777 template<typename T, typename std::enable_if<std::is_same<T, Settings::Iris>::value,
int>::type = 0>
2783 template<typename T, typename std::enable_if<std::is_same<T, Settings::RedBalance>::value,
int>::type = 0>
2786 return m_redBalance;
2789 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
2792 return m_bidirectional;
2795 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
2798 return m_blueBalance;
2801 template<size_t i, typename std::enable_if<i == 2, int>::type = 0>
2804 return m_brightness;
2807 template<size_t i, typename std::enable_if<i == 3, int>::type = 0>
2810 return m_exposureTime;
2813 template<size_t i, typename std::enable_if<i == 4, int>::type = 0>
2819 template<size_t i, typename std::enable_if<i == 5, int>::type = 0>
2825 template<size_t i, typename std::enable_if<i == 6, int>::type = 0>
2831 template<size_t i, typename std::enable_if<i == 7, int>::type = 0>
2834 return m_redBalance;
2852 Settings &set(
const Bidirectional &value)
2854 m_bidirectional = value;
2858 const Bidirectional &bidirectional()
const
2860 return m_bidirectional;
2868 Settings &set(
const BlueBalance &value)
2870 if(value.value() < value.range().min() || value.value() > value.range().max())
2872 throw std::out_of_range(
"BlueBalance{ " + std::to_string(value.value()) +
" } is not in range ["
2873 + std::to_string(value.range().min()) +
", "
2874 + std::to_string(value.range().max()) +
"]");
2877 m_blueBalance = value;
2883 return m_blueBalance;
2891 Settings &set(
const Brightness &value)
2893 if(value.value() < value.range().min() || value.value() > value.range().max())
2895 throw std::out_of_range(
"Brightness{ " + std::to_string(value.value()) +
" } is not in range ["
2896 + std::to_string(value.range().min()) +
", "
2897 + std::to_string(value.range().max()) +
"]");
2900 m_brightness = value;
2904 const Brightness &brightness()
const
2906 return m_brightness;
2910 ExposureTime m_exposureTime{};
2916 if(value.
value().count() < value.
range().min().count()
2917 || value.
value().count() > value.
range().max().count())
2919 throw std::out_of_range(
"ExposureTime{ " + std::to_string(value.
value().count())
2920 +
" } is not in range [" + std::to_string(value.
range().min().count()) +
", "
2921 + std::to_string(value.
range().max().count()) +
"]");
2924 m_exposureTime = value;
2928 const ExposureTime &exposureTime()
const
2930 return m_exposureTime;
2934 Filters m_filters{};
2938 Settings &set(
const Filters &value)
2944 const Filters &filters()
const
2950 Settings &set(
const Filters::Contrast &value)
2952 m_filters.
set(value);
2957 Settings &set(
const Filters::Contrast::Enabled &value)
2959 m_filters.set(value);
2964 Settings &set(
const Filters::Contrast::Threshold &value)
2966 m_filters.
set(value);
2971 Settings &set(
const Filters::Gaussian &value)
2973 m_filters.set(value);
2978 Settings &set(
const Filters::Gaussian::Enabled &value)
2980 m_filters.set(value);
2987 m_filters.
set(value);
2992 Settings &set(
const Filters::Outlier &value)
2994 m_filters.
set(value);
2999 Settings &set(
const Filters::Outlier::Enabled &value)
3001 m_filters.
set(value);
3006 Settings &set(
const Filters::Outlier::Threshold &value)
3008 m_filters.set(value);
3013 Settings &set(
const Filters::Reflection &value)
3015 m_filters.
set(value);
3020 Settings &set(
const Filters::Reflection::Enabled &value)
3022 m_filters.
set(value);
3027 Settings &set(
const Filters::Saturated &value)
3034 Settings &set(
const Filters::Saturated::Enabled &value)
3049 throw std::out_of_range(
"Gain{ " + std::to_string(value.
value()) +
" } is not in range ["
3050 + std::to_string(value.
range().min()) +
", "
3051 + std::to_string(value.
range().max()) +
"]");
3058 const Gain &gain()
const
3070 if(value.value() < value.range().min() || value.value() > value.range().max())
3072 throw std::out_of_range(
"Iris{ " + std::to_string(value.value()) +
" } is not in range ["
3073 + std::to_string(value.range().min()) +
", "
3074 + std::to_string(value.range().max()) +
"]");
3081 const Iris &iris()
const
3091 Settings &set(
const RedBalance &value)
3093 if(value.value() < value.range().min() || value.value() > value.range().max())
3095 throw std::out_of_range(
"RedBalance{ " + std::to_string(value.value()) +
" } is not in range ["
3096 + std::to_string(value.range().min()) +
", "
3097 + std::to_string(value.range().max()) +
"]");
3100 m_redBalance = value;
3104 const RedBalance &redBalance()
const
3106 return m_redBalance;
3110 template<
typename F>
3111 void forEach(
const F &f)
const
3124 template<
typename F>
3125 void forEach(
const F &f)
3138 template<
typename F>
3139 void traverseValues(
const F &f)
const
3145 m_filters.traverseValues(f);
3152 template<
typename F>
3153 void traverseValues(
const F &f)
3159 m_filters.traverseValues(f);
3175 void setFromString(
const std::string &value);
3178 friend std::istream &operator>>(std::istream &stream,
Settings &value)
3181 std::string{ std::istreambuf_iterator<char>{ stream }, std::istreambuf_iterator<char>{} });
3186 bool operator==(
const Settings &other)
const;
3189 bool operator!=(
const Settings &other)
const;
3192 explicit Settings(
const std::string &fileName);
3195 void save(
const std::string &fileName)
const;
3198 void load(
const std::string &fileName);
3203 struct Settings::Version<3>
3212 # pragma warning(pop)
3216 # if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
3227 = decltype(declval<Zivid::Settings::Filters::Contrast>().get<i>());
3238 = decltype(declval<Zivid::Settings::Filters::Gaussian>().get<i>());
3242 struct tuple_size<
Zivid::Settings::Filters::Outlier> : integral_constant<size_t, 2>
3246 struct tuple_element<i,
Zivid::Settings::Filters::Outlier>
3249 = decltype(declval<Zivid::Settings::Filters::Outlier>().get<i>());
3260 = decltype(declval<Zivid::Settings::Filters::Reflection>().get<i>());
3268 struct tuple_element<i,
Zivid::Settings::Filters::Saturated>
3271 = decltype(declval<Zivid::Settings::Filters::Saturated>().get<i>());
3275 struct tuple_size<
Zivid::Settings::Filters> : integral_constant<size_t, 5>
3279 struct tuple_element<i,
Zivid::Settings::Filters>
3282 = decltype(declval<Zivid::Settings::Filters>().get<i>());
3286 struct tuple_size<
Zivid::Settings> : integral_constant<size_t, 8>
3290 struct tuple_element<i,
Zivid::Settings>
3293 = decltype(declval<Zivid::Settings>().get<i>());