68# pragma warning(disable : 4251)
73 namespace CaptureAssistant
88 static constexpr const char *path{
"" };
91 static constexpr const char *name{
"SuggestSettingsParameters" };
94 static constexpr const char *description{
95 R
"description(Used to specify a constraint on the total capture time for the settings suggested by the Capture Assistant, and
96optionally specify the ambient light frequency.
100 static constexpr size_t version{ 1 };
110 static constexpr std::array<uint8_t, 3> binaryId{
's',
's',
'p' };
130 static constexpr const char *path{
"AmbientLightFrequency" };
133 static constexpr const char *name{
"AmbientLightFrequency" };
136 static constexpr const char *description{
137 R
"description(Adapt suggested settings to the ambient light frequency. This can be used to avoid artifacts in the point
138cloud due to AC powered ambient light being mixed in with the camera's projector light.
140Select your power grid frequency. 60 Hz is typically used in Japan, Americas, Taiwan, South Korea, and the
141Philippines. 50 Hz is the normal in rest of the world. If ambient light is unproblematic, turn off for
160 return { ValueType::none, ValueType::hz50, ValueType::hz60 };
168 : m_value{ verifyValue(value) }
186 return m_value == other.m_value;
192 return m_value != other.m_value;
202 void setFromString(
const std::string &value);
204 constexpr ValueType
static verifyValue(
const ValueType &value)
206 return value == ValueType::none || value == ValueType::hz50 || value == ValueType::hz60
208 :
throw std::invalid_argument{
209 "Invalid value: AmbientLightFrequency{ "
210 + std::to_string(
static_cast<std::underlying_type<ValueType>::type
>(value)) +
" }"
232 static constexpr const char *path{
"MaxCaptureTime" };
235 static constexpr const char *name{
"MaxCaptureTime" };
238 static constexpr const char *description{
239 R
"description(Capture time budget. This budget assumes a high-end computer meeting Zivid's recommendations. The actual
240capture time may differ, based on your computer's performance and (for Zivid 2 and 2+) your network connection
251 return { std::chrono::milliseconds{ 200 }, std::chrono::milliseconds{ 10000 } };
259 : m_value{ verifyValue(value) }
263 std::chrono::milliseconds
value()
const;
271 return m_value == other.m_value;
277 return m_value != other.m_value;
283 return m_value < other.m_value;
289 return m_value > other.m_value;
295 return m_value <= other.m_value;
301 return m_value >= other.m_value;
311 void setFromString(
const std::string &value);
313 constexpr ValueType
static verifyValue(
const ValueType &value)
315 return validRange().isInRange(value)
317 :
throw std::out_of_range{
"MaxCaptureTime{ " + std::to_string(value.count())
318 +
" } is not in range ["
319 + std::to_string(validRange().min().count()) +
", "
320 + std::to_string(validRange().max().count()) +
"]" };
323 std::chrono::milliseconds m_value{ 1200 };
329 std::tuple<SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime>;
366 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
367 typename std::enable_if<
368 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::
372 template<typename... Args>
376 using namespace Zivid::Detail::TypeTraits;
379 AllArgsDecayedAreUnique<Args...>::value,
380 "Found duplicate types among the arguments passed to SuggestSettingsParameters(...). "
381 "Types should be listed at most once.");
383 set(std::forward<Args>(args)...);
398 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
400 template<typename... Args>
404 using namespace Zivid::Detail::TypeTraits;
406 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
408 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
411 AllArgsDecayedAreUnique<Args...>::value,
412 "Found duplicate types among the arguments passed to set(...). "
413 "Types should be listed at most once.");
415 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
431 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
433 template<typename... Args>
437 using namespace Zivid::Detail::TypeTraits;
439 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
441 AllArgsAreDescendantNodes::value,
442 "All arguments passed to copyWith(...) must be descendant nodes.");
445 AllArgsDecayedAreUnique<Args...>::value,
446 "Found duplicate types among the arguments passed to copyWith(...). "
447 "Types should be listed at most once.");
450 copy.set(std::forward<Args>(args)...);
457 return m_ambientLightFrequency;
463 return m_ambientLightFrequency;
469 m_ambientLightFrequency = value;
476 return m_maxCaptureTime;
482 return m_maxCaptureTime;
488 m_maxCaptureTime = value;
494 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::AmbientLightFrequency>::value,
int>::
498 return m_ambientLightFrequency;
503 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::MaxCaptureTime>::value,
int>::type =
507 return m_maxCaptureTime;
510 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
513 return m_ambientLightFrequency;
516 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
519 return m_maxCaptureTime;
526 f(m_ambientLightFrequency);
534 f(m_ambientLightFrequency);
554 void save(
const std::string &fileName)
const;
557 void load(
const std::string &fileName);
560 void setFromString(
const std::string &value);
562 void setFromString(
const std::string &fullPath,
const std::string &value);
564 std::string getString(
const std::string &fullPath)
const;
574 struct SuggestSettingsParameters::Version<1>
590 std::ostream &ostream);
597 const std::vector<uint8_t> &data);
607# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
612 struct tuple_size<
Zivid::CaptureAssistant::SuggestSettingsParameters> : integral_constant<size_t, 2>
616 struct tuple_element<i,
Zivid::CaptureAssistant::SuggestSettingsParameters>
619 i < tuple_size<Zivid::CaptureAssistant::SuggestSettingsParameters>::value,
620 "Index must be less than 2");
623 =
decltype(declval<Zivid::CaptureAssistant::SuggestSettingsParameters>().get<i>());
632#if defined(__has_include) && !defined(NO_DOC)
634 "Zivid/CaptureAssistant/SuggestSettingsParametersInternal.h") \
635 && __has_include("Zivid/DataModelNodeMetaData.h")
636# include "Zivid/CaptureAssistant/SuggestSettingsParametersInternal.h"
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Adapt suggested settings to the ambient light frequency. This can be used to avoid artifacts in the p...
Definition SuggestSettingsParameters.h:124
ValueType value() const
Get the value.
constexpr AmbientLightFrequency(ValueType value)
Constructor.
Definition SuggestSettingsParameters.h:167
static std::set< ValueType > validValues()
All valid values of AmbientLightFrequency.
Definition SuggestSettingsParameters.h:158
AmbientLightFrequency()=default
Default constructor.
static const AmbientLightFrequency none
none
Definition SuggestSettingsParameters.h:153
bool operator==(const AmbientLightFrequency &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:184
static const AmbientLightFrequency hz60
hz60
Definition SuggestSettingsParameters.h:155
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency::ValueType &value)
Operator to serialize ValueType to a stream.
Definition SuggestSettingsParameters.h:178
bool operator!=(const AmbientLightFrequency &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:190
static const AmbientLightFrequency hz50
hz50
Definition SuggestSettingsParameters.h:154
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency &value)
Operator to serialize the value to a stream.
Definition SuggestSettingsParameters.h:196
std::string toString() const
Get the value as string.
ValueType
The type of the underlying value.
Definition SuggestSettingsParameters.h:148
Capture time budget. This budget assumes a high-end computer meeting Zivid's recommendations....
Definition SuggestSettingsParameters.h:226
bool operator>(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:287
bool operator==(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:269
bool operator<(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:281
static constexpr Range< std::chrono::milliseconds > validRange()
The range of valid values for MaxCaptureTime.
Definition SuggestSettingsParameters.h:249
constexpr MaxCaptureTime(std::chrono::milliseconds value)
Constructor.
Definition SuggestSettingsParameters.h:258
bool operator>=(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:299
bool operator<=(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:293
bool operator!=(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:275
std::chrono::milliseconds ValueType
The type of the underlying value.
Definition SuggestSettingsParameters.h:246
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const MaxCaptureTime &value)
Operator to serialize the value to a stream.
Definition SuggestSettingsParameters.h:305
MaxCaptureTime()=default
Default constructor.
std::chrono::milliseconds value() const
Get the value.
Used to specify a constraint on the total capture time for the settings suggested by the Capture Assi...
Definition SuggestSettingsParameters.h:82
SuggestSettingsParameters & set(const MaxCaptureTime &value)
Set MaxCaptureTime.
Definition SuggestSettingsParameters.h:486
void save(const std::string &fileName) const
Save to the given file.
void set(Args &&...args)
Set multiple arguments.
Definition SuggestSettingsParameters.h:402
std::string serialize() const
Serialize to a string.
std::tuple< SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime > Descendants
Definition SuggestSettingsParameters.h:328
const AmbientLightFrequency & ambientLightFrequency() const
Get AmbientLightFrequency.
Definition SuggestSettingsParameters.h:455
SuggestSettingsParameters copyWith(Args &&...args) const
Returns a copy of this object with the given argument(s) set to the new value(s)
Definition SuggestSettingsParameters.h:435
static SuggestSettingsParameters fromSerialized(const std::string &value)
Construct a new SuggestSettingsParameters instance from a previously serialized string.
AmbientLightFrequency & ambientLightFrequency()
Get AmbientLightFrequency.
Definition SuggestSettingsParameters.h:461
MaxCaptureTime & maxCaptureTime()
Get MaxCaptureTime.
Definition SuggestSettingsParameters.h:480
bool operator!=(const SuggestSettingsParameters &other) const
Inequality operator.
const SuggestSettingsParameters::MaxCaptureTime & get() const
Definition SuggestSettingsParameters.h:505
bool operator==(const SuggestSettingsParameters &other) const
Equality operator.
SuggestSettingsParameters(const std::string &fileName)
Construct SuggestSettingsParameters by loading from file.
void forEach(const F &f) const
Run the given function on each direct member with the value of the member as parameter.
Definition SuggestSettingsParameters.h:524
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SuggestSettingsParameters.h:532
SuggestSettingsParameters()
Default constructor.
const MaxCaptureTime & maxCaptureTime() const
Get MaxCaptureTime.
Definition SuggestSettingsParameters.h:474
SuggestSettingsParameters & set(const AmbientLightFrequency &value)
Set AmbientLightFrequency.
Definition SuggestSettingsParameters.h:467
std::string toString() const
Get the value as string.
friend std::ostream & operator<<(std::ostream &stream, const SuggestSettingsParameters &value)
Operator to send the value as string to a stream.
Definition SuggestSettingsParameters.h:548
void load(const std::string &fileName)
Load from the given file.
const SuggestSettingsParameters::AmbientLightFrequency & get() const
Definition SuggestSettingsParameters.h:496
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