34#include <visp3/core/vpConfig.h>
35#include <visp3/core/vpMatrix.h>
36#include <visp3/core/vpHomogeneousMatrix.h>
37#include <visp3/core/vpCameraParameters.h>
38#include <visp3/core/vpMeterPixelConversion.h>
39#include <visp3/core/vpPixelMeterConversion.h>
48 vpPointMap(
unsigned maxPoints,
double minDistNewPoints,
double maxDepthErrorVisibility,
double maxDepthErrorCandidate,
double outlierThreshold)
50 m_maxPoints = maxPoints;
51 m_minDistNewPoint = minDistNewPoints;
52 m_maxDepthErrorVisible = maxDepthErrorVisibility;
53 m_maxDepthErrorCandidate = maxDepthErrorCandidate;
54 m_outlierThreshold = outlierThreshold;
55 m_normalThresholdVisible = 0.0;
65 m_maxPoints = maxNumPoints;
98 void getVisiblePoints(
const unsigned int h,
const unsigned int w,
const vpMatrix &cX,
const vpMatrix &uvs,
const vpColVector &expectedZ, std::vector<int> &indices);
102 const vpMatrix &observations, std::vector<int> &indices);
109 void updatePoints(
const vpArray2D<int> &indicesToRemove,
const vpMatrix &pointsToAdd,
const vpMatrix &normalsToAdd, std::vector<int> &removedIndices,
unsigned int &numAddedPoints);
110 void updatePoint(
unsigned int index,
double X,
double Y,
double Z)
121 e.resize(indices.
getRows() * 2, 1,
false);
127 for (
unsigned int i = 0; i < indices.
getRows(); ++i) {
128 const unsigned int pointIndex = indices[i][0];
129 const double *p = m_X[pointIndex];
130 wX[0] = p[0]; wX[1] = p[1]; wX[2] = p[2];
133 const double Z = cX[2];
134 const double x = cX[0] / Z;
135 const double y = cX[1] / Z;
137 e[i * 2] = x - observations[i][0];
138 e[i * 2 + 1] = y - observations[i][1];
140 J[i * 2][0] = -1.0 / Z; J[i * 2][1] = 0.0; J[i * 2][2] = x / Z;
141 J[i * 2][3] = x * y; J[i * 2][4] = -(1.0 + x * x); J[i * 2][5] = y;
143 J[i * 2 + 1][0] = 0.0; J[i * 2 + 1][1] = -1.0 / Z; J[i * 2 + 1][2] = y / Z;
144 J[i * 2 + 1][3] = 1.0 + y * y; J[i * 2 + 1][4] = -(x * y); J[i * 2 + 1][5] = -x;
151 e.resize(indices.
getRows() * 3, 1,
false);
157 for (
unsigned int i = 0; i < indices.
getRows(); ++i) {
158 const unsigned int pointIndex = indices[i][0];
159 const double *p = m_X[pointIndex];
160 wX[0] = p[0]; wX[1] = p[1]; wX[2] = p[2];
164 const double X = cX[0], Y = cX[1], Z = cX[2];
166 e[i * 3] = X - observations[i][0];
167 e[i * 3 + 1] = Y - observations[i][1];
168 e[i * 3 + 2] = Z - observations[i][2];
171 J[i * 3 + 1][1] = -1;
172 J[i * 3 + 2][2] = -1;
178 J[i * 3 + 1][5] = -X;
180 J[i * 3 + 2][3] = -Y;
189 unsigned m_maxPoints;
190 double m_minDistNewPoint;
191 double m_maxDepthErrorVisible;
192 double m_normalThresholdVisible;
193 double m_maxDepthErrorCandidate;
194 double m_outlierThreshold;
Implementation of a generic 2D array used as base class for matrices and vectors.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int getRows() const
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition of the vpImage class member functions.
Implementation of a matrix and operations on matrices.
void setOutlierReprojectionErrorThreshold(double thresholdPx)
void setMaxDepthErrorVisibilityCriterion(double depthError)
unsigned int getNumMaxPoints() const
void setMaxDepthErrorCandidate(double depthError)
double getMinDistanceAddNewPoints() const
vpPointMap(unsigned maxPoints, double minDistNewPoints, double maxDepthErrorVisibility, double maxDepthErrorCandidate, double outlierThreshold)
double getMaxDepthErrorCandidate() const
void setMinDistanceAddNewPoints(double distance)
void setPoints(const vpMatrix &X)
double getOutlierReprojectionErrorThreshold() const
void setNumMaxPoints(unsigned int maxNumPoints)
double getThresholdNormalVisibiltyCriterion() const
void updatePoint(unsigned int index, double X, double Y, double Z)
void setThresholdNormalVisibiltyCriterion(double normalDegThreshold)
void computeReprojectionErrorAndJacobian(const vpArray2D< int > &indices, const vpHomogeneousMatrix &cTw, const vpMatrix &observations, vpMatrix &J, vpColVector &e) const
const vpMatrix & getPoints()
void compute3DErrorAndJacobian(const vpArray2D< int > &indices, const vpHomogeneousMatrix &cTw, const vpMatrix &observations, vpMatrix &J, vpColVector &e) const
double getMaxDepthErrorVisibilityCriterion() const
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.