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>;
352 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
353 typename std::enable_if<
354 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::
358 template<typename... Args>
362 using namespace Zivid::Detail::TypeTraits;
365 AllArgsDecayedAreUnique<Args...>::value,
366 "Found duplicate types among the arguments passed to SuggestSettingsParameters(...). "
367 "Types should be listed at most once.");
369 set(std::forward<Args>(args)...);
384 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
386 template<typename... Args>
390 using namespace Zivid::Detail::TypeTraits;
392 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
394 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
397 AllArgsDecayedAreUnique<Args...>::value,
398 "Found duplicate types among the arguments passed to set(...). "
399 "Types should be listed at most once.");
401 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
417 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
419 template<typename... Args>
423 using namespace Zivid::Detail::TypeTraits;
425 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
427 AllArgsAreDescendantNodes::value,
428 "All arguments passed to copyWith(...) must be descendant nodes.");
431 AllArgsDecayedAreUnique<Args...>::value,
432 "Found duplicate types among the arguments passed to copyWith(...). "
433 "Types should be listed at most once.");
436 copy.
set(std::forward<Args>(args)...);
443 return m_ambientLightFrequency;
449 return m_ambientLightFrequency;
455 m_ambientLightFrequency = value;
462 return m_maxCaptureTime;
468 return m_maxCaptureTime;
474 m_maxCaptureTime = value;
480 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::AmbientLightFrequency>::value,
int>::
484 return m_ambientLightFrequency;
489 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::MaxCaptureTime>::value,
int>::type =
493 return m_maxCaptureTime;
496 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
499 return m_ambientLightFrequency;
502 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
505 return m_maxCaptureTime;
512 f(m_ambientLightFrequency);
520 f(m_ambientLightFrequency);
540 void save(
const std::string &fileName)
const;
543 void load(
const std::string &fileName);
546 void setFromString(
const std::string &value);
548 void setFromString(
const std::string &fullPath,
const std::string &value);
550 std::string getString(
const std::string &fullPath)
const;
569 struct SuggestSettingsParameters::Version<1>
571 using Type = SuggestSettingsParameters;
583# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
588 struct tuple_size<
Zivid::CaptureAssistant::SuggestSettingsParameters> : integral_constant<size_t, 2>
592 struct tuple_element<i,
Zivid::CaptureAssistant::SuggestSettingsParameters>
595 i < tuple_size<Zivid::CaptureAssistant::SuggestSettingsParameters>::value,
596 "Index must be less than 2");
599 =
decltype(declval<Zivid::CaptureAssistant::SuggestSettingsParameters>().get<i>());
608#if defined(__has_include) && !defined(NO_DOC)
610 "Zivid/CaptureAssistant/SuggestSettingsParametersInternal.h") \
611 && __has_include("Zivid/DataModelNodeMetaData.h")
612# 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:472
void save(const std::string &fileName) const
Save to the given file.
void set(Args &&...args)
Set multiple arguments.
Definition SuggestSettingsParameters.h:388
std::tuple< SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime > Descendants
Definition SuggestSettingsParameters.h:328
const AmbientLightFrequency & ambientLightFrequency() const
Get AmbientLightFrequency.
Definition SuggestSettingsParameters.h:441
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:421
AmbientLightFrequency & ambientLightFrequency()
Get AmbientLightFrequency.
Definition SuggestSettingsParameters.h:447
MaxCaptureTime & maxCaptureTime()
Get MaxCaptureTime.
Definition SuggestSettingsParameters.h:466
bool operator!=(const SuggestSettingsParameters &other) const
Inequality operator.
const SuggestSettingsParameters::MaxCaptureTime & get() const
Definition SuggestSettingsParameters.h:491
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:510
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SuggestSettingsParameters.h:518
SuggestSettingsParameters()
Default constructor.
const MaxCaptureTime & maxCaptureTime() const
Get MaxCaptureTime.
Definition SuggestSettingsParameters.h:460
SuggestSettingsParameters & set(const AmbientLightFrequency &value)
Set AmbientLightFrequency.
Definition SuggestSettingsParameters.h:453
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:534
void load(const std::string &fileName)
Load from the given file.
const SuggestSettingsParameters::AmbientLightFrequency & get() const
Definition SuggestSettingsParameters.h:482
Class describing a range of values for a given type T.
Definition Range.h:73
NodeType
Definition NodeType.h:55
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:54