36 #ifndef VP_RB_SILHOUETTE_POINTS_EXTRACTION_SETTINGS_H
37 #define VP_RB_SILHOUETTE_POINTS_EXTRACTION_SETTINGS_H
39 #include <visp3/core/vpConfig.h>
41 #if defined(VISP_HAVE_PANDA3D)
42 #include <visp3/core/vpMath.h>
43 #include <visp3/core/vpMatrix.h>
44 #include <visp3/core/vpImage.h>
45 #include <visp3/core/vpUniRand.h>
48 #if defined(VISP_HAVE_NLOHMANN_JSON)
49 #include VISP_NLOHMANN_JSON(json.hpp)
64 unsigned int m_sampleStep;
66 unsigned int m_border;
68 double m_depthThreshold;
69 bool m_thresholdIsRelative;
70 bool m_preferPreviousPoints;
72 void sampleWithoutReplacement(
unsigned int count,
unsigned int vectorSize, std::vector<size_t> &indices,
vpUniRand &random)
const
74 count = std::min(count, vectorSize);
75 indices.resize(count);
76 unsigned int added = 0;
77 for (
unsigned i = 0; i < vectorSize; ++i) {
78 double randomVal = random.
uniform(0.0, 1.0);
79 if ((vectorSize - i) * randomVal < (count - added)) {
108 if (m_sampleStep == 0) {
114 std::vector<std::pair<unsigned int, unsigned int>> getSilhouetteCandidates(
117 const std::vector<vpRBSilhouettePoint> &previousPoints,
long randomSeed = 41)
const;
119 #if defined(VISP_HAVE_NLOHMANN_JSON)
125 #if defined(VISP_HAVE_NLOHMANN_JSON)
128 nlohmann::json thresholdSettings = j.at(
"threshold");
129 std::string thresholdType = thresholdSettings.at(
"type");
130 settings.m_thresholdIsRelative = thresholdType ==
"relative";
131 settings.m_depthThreshold = thresholdSettings.at(
"value");
133 nlohmann::json samplingSettings = j.at(
"sampling");
134 settings.m_preferPreviousPoints = samplingSettings.at(
"reusePreviousPoints");
135 settings.m_maxNumPoints = samplingSettings.at(
"numPoints");
Generic class defining intrinsic camera parameters.
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Silhouette point simple candidate representation.
Class for generating random numbers with uniform probability density.
int uniform(int a, int b)