69# pragma warning(disable : 4251)
74 namespace CaptureAssistant
89 static constexpr const char *path{
"" };
92 static constexpr const char *name{
"SuggestSettingsParameters" };
95 static constexpr const char *description{
96 R
"description(Used to specify a constraint on the total capture time for the settings suggested by the Capture Assistant, and
97optionally specify the ambient light frequency.
101 static constexpr size_t version{ 1 };
111 static constexpr std::array<uint8_t, 3> binaryId{
's',
's',
'p' };
131 static constexpr const char *path{
"AmbientLightFrequency" };
134 static constexpr const char *name{
"AmbientLightFrequency" };
137 static constexpr const char *description{
138 R
"description(Adapt suggested settings to the ambient light frequency. This can be used to avoid artifacts in the point
139cloud due to AC powered ambient light being mixed in with the camera's projector light.
141Select your power grid frequency. 60 Hz is typically used in Japan, Americas, Taiwan, South Korea, and the
142Philippines. 50 Hz is the normal in rest of the world. If ambient light is unproblematic, turn off for
161 return { ValueType::none, ValueType::hz50, ValueType::hz60 };
169 : m_value{ verifyValue(value) }
187 return m_value == other.m_value;
193 return m_value != other.m_value;
203 void setFromString(
const std::string &value);
205 constexpr ValueType
static verifyValue(
const ValueType &value)
207 return value == ValueType::none || value == ValueType::hz50 || value == ValueType::hz60
209 :
throw std::invalid_argument{
210 "Invalid value: AmbientLightFrequency{ "
211 + std::to_string(
static_cast<std::underlying_type<ValueType>::type
>(value)) +
" }"
233 static constexpr const char *path{
"MaxCaptureTime" };
236 static constexpr const char *name{
"MaxCaptureTime" };
239 static constexpr const char *description{
240 R
"description(Capture time budget. This budget assumes a high-end computer meeting Zivid's recommendations. The actual
241capture time may differ, based on your computer's performance and (for Zivid 2 and 2+) your network connection
252 return { std::chrono::milliseconds{ 200 }, std::chrono::milliseconds{ 10000 } };
260 : m_value{ verifyValue(value) }
264 std::chrono::milliseconds
value()
const;
272 return m_value == other.m_value;
278 return m_value != other.m_value;
284 return m_value < other.m_value;
290 return m_value > other.m_value;
296 return m_value <= other.m_value;
302 return m_value >= other.m_value;
312 void setFromString(
const std::string &value);
314 constexpr ValueType
static verifyValue(
const ValueType &value)
316 return validRange().isInRange(value)
318 :
throw std::out_of_range{
"MaxCaptureTime{ " + std::to_string(value.count())
319 +
" } is not in range ["
320 + std::to_string(validRange().min().count()) +
", "
321 + std::to_string(validRange().max().count()) +
"]" };
324 std::chrono::milliseconds m_value{ 1200 };
330 std::tuple<SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime>;
367 typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0,
368 typename std::enable_if<
369 Zivid::Detail::TypeTraits::AllArgsAreInTuple<
Descendants,
typename std::decay<Args>::type...>::
373 template<typename... Args>
377 using namespace Zivid::Detail::TypeTraits;
380 AllArgsDecayedAreUnique<Args...>::value,
381 "Found duplicate types among the arguments passed to SuggestSettingsParameters(...). "
382 "Types should be listed at most once.");
384 set(std::forward<Args>(args)...);
399 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 2,
int>::type = 0>
401 template<typename... Args>
405 using namespace Zivid::Detail::TypeTraits;
407 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
409 AllArgsAreDescendantNodes::value,
"All arguments passed to set(...) must be descendant nodes.");
412 AllArgsDecayedAreUnique<Args...>::value,
413 "Found duplicate types among the arguments passed to set(...). "
414 "Types should be listed at most once.");
416 Zivid::DataModel::Detail::invokeSetWithEachArgument(*
this, std::forward<Args>(args)...);
432 template<
typename... Args,
typename std::enable_if<
sizeof...(Args) >= 1,
int>::type = 0>
434 template<typename... Args>
438 using namespace Zivid::Detail::TypeTraits;
440 using AllArgsAreDescendantNodes = AllArgsAreInTuple<Descendants, typename std::decay<Args>::type...>;
442 AllArgsAreDescendantNodes::value,
443 "All arguments passed to copyWith(...) must be descendant nodes.");
446 AllArgsDecayedAreUnique<Args...>::value,
447 "Found duplicate types among the arguments passed to copyWith(...). "
448 "Types should be listed at most once.");
451 copy.
set(std::forward<Args>(args)...);
458 return m_ambientLightFrequency;
464 return m_ambientLightFrequency;
470 m_ambientLightFrequency = value;
477 return m_maxCaptureTime;
483 return m_maxCaptureTime;
489 m_maxCaptureTime = value;
495 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::AmbientLightFrequency>::value,
int>::
499 return m_ambientLightFrequency;
504 typename std::enable_if<std::is_same<T, SuggestSettingsParameters::MaxCaptureTime>::value,
int>::type =
508 return m_maxCaptureTime;
511 template<size_t i, typename std::enable_if<i == 0, int>::type = 0>
514 return m_ambientLightFrequency;
517 template<size_t i, typename std::enable_if<i == 1, int>::type = 0>
520 return m_maxCaptureTime;
527 f(m_ambientLightFrequency);
535 f(m_ambientLightFrequency);
555 void save(
const std::string &fileName)
const;
558 void load(
const std::string &fileName);
561 void setFromString(
const std::string &value);
563 void setFromString(
const std::string &fullPath,
const std::string &value);
565 std::string getString(
const std::string &fullPath)
const;
584 struct SuggestSettingsParameters::Version<1>
586 using Type = SuggestSettingsParameters;
598# if !(defined(_MSC_VER) && (_MSC_VER <= 1900))
603 struct tuple_size<
Zivid::CaptureAssistant::SuggestSettingsParameters> : integral_constant<size_t, 2>
607 struct tuple_element<i,
Zivid::CaptureAssistant::SuggestSettingsParameters>
610 i < tuple_size<Zivid::CaptureAssistant::SuggestSettingsParameters>::value,
611 "Index must be less than 2");
614 =
decltype(declval<Zivid::CaptureAssistant::SuggestSettingsParameters>().get<i>());
623#if defined(__has_include) && !defined(NO_DOC)
625 "Zivid/CaptureAssistant/SuggestSettingsParametersInternal.h") \
626 && __has_include("Zivid/DataModelNodeMetaData.h")
627# include "Zivid/CaptureAssistant/SuggestSettingsParametersInternal.h"
#define ZIVID_NODISCARD
Definition Attributes.h:49
#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:125
ValueType value() const
Get the value.
constexpr AmbientLightFrequency(ValueType value)
Constructor.
Definition SuggestSettingsParameters.h:168
static std::set< ValueType > validValues()
All valid values of AmbientLightFrequency.
Definition SuggestSettingsParameters.h:159
AmbientLightFrequency()=default
Default constructor.
static const AmbientLightFrequency none
none
Definition SuggestSettingsParameters.h:154
bool operator==(const AmbientLightFrequency &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:185
static const AmbientLightFrequency hz60
hz60
Definition SuggestSettingsParameters.h:156
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency::ValueType &value)
Operator to serialize ValueType to a stream.
Definition SuggestSettingsParameters.h:179
bool operator!=(const AmbientLightFrequency &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:191
static const AmbientLightFrequency hz50
hz50
Definition SuggestSettingsParameters.h:155
friend std::ostream & operator<<(std::ostream &stream, const AmbientLightFrequency &value)
Operator to serialize the value to a stream.
Definition SuggestSettingsParameters.h:197
std::string toString() const
Get the value as string.
ValueType
The type of the underlying value.
Definition SuggestSettingsParameters.h:149
Capture time budget. This budget assumes a high-end computer meeting Zivid's recommendations....
Definition SuggestSettingsParameters.h:227
bool operator>(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:288
bool operator==(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:270
bool operator<(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:282
static constexpr Range< std::chrono::milliseconds > validRange()
The range of valid values for MaxCaptureTime.
Definition SuggestSettingsParameters.h:250
constexpr MaxCaptureTime(std::chrono::milliseconds value)
Constructor.
Definition SuggestSettingsParameters.h:259
bool operator>=(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:300
bool operator<=(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:294
bool operator!=(const MaxCaptureTime &other) const
Comparison operator.
Definition SuggestSettingsParameters.h:276
std::chrono::milliseconds ValueType
The type of the underlying value.
Definition SuggestSettingsParameters.h:247
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:306
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:83
static ZIVID_NODISCARD SuggestSettingsParameters fromSerialized(const std::string &value)
Construct a new SuggestSettingsParameters instance from a previously serialized string.
SuggestSettingsParameters & set(const MaxCaptureTime &value)
Set MaxCaptureTime.
Definition SuggestSettingsParameters.h:487
void save(const std::string &fileName) const
Save to the given file.
void set(Args &&...args)
Set multiple arguments.
Definition SuggestSettingsParameters.h:403
std::string serialize() const
Serialize to a string.
std::tuple< SuggestSettingsParameters::AmbientLightFrequency, SuggestSettingsParameters::MaxCaptureTime > Descendants
Definition SuggestSettingsParameters.h:329
const AmbientLightFrequency & ambientLightFrequency() const
Get AmbientLightFrequency.
Definition SuggestSettingsParameters.h:456
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:436
AmbientLightFrequency & ambientLightFrequency()
Get AmbientLightFrequency.
Definition SuggestSettingsParameters.h:462
MaxCaptureTime & maxCaptureTime()
Get MaxCaptureTime.
Definition SuggestSettingsParameters.h:481
bool operator!=(const SuggestSettingsParameters &other) const
Inequality operator.
const SuggestSettingsParameters::MaxCaptureTime & get() const
Definition SuggestSettingsParameters.h:506
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:525
void forEach(const F &f)
Run the given function on each direct member with the value of the member as parameter.
Definition SuggestSettingsParameters.h:533
SuggestSettingsParameters()
Default constructor.
const MaxCaptureTime & maxCaptureTime() const
Get MaxCaptureTime.
Definition SuggestSettingsParameters.h:475
SuggestSettingsParameters & set(const AmbientLightFrequency &value)
Set AmbientLightFrequency.
Definition SuggestSettingsParameters.h:468
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:549
void load(const std::string &fileName)
Load from the given file.
const SuggestSettingsParameters::AmbientLightFrequency & get() const
Definition SuggestSettingsParameters.h:497
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:56