103 printf(
"error: input image must be grayscale image for CTracker2d3d::Track\n");
110 printf(
"error: calibration does not match image in CTracker2d3d::Track\n");
114 const int nMaxPoints = 10000;
117 Vec2d *pPointList2dProjection =
new Vec2d[nMaxPoints];
129 for (
int nRun = 0;; nRun++)
134 for (i = 0; i < nOutlinePoints; i += 2)
152 p1_.
x = temp.
x / temp.
z;
153 p1_.
y = temp.
y / temp.
z;
157 p2_.
x = temp.
x / temp.
z;
158 p2_.
y = temp.
y / temp.
z;
164 if (nControlPoints < 1 || nControlPoints > 10000)
173 Vec2d u_ = { p1_.
x - p2_.
x, p1_.
y - p2_.
y };
183 for (
int j = 0; j < nControlPoints; j++)
195 Vec3d temp3 = { temp2.
x, temp2.
y, 1 };
199 p_.
x = temp3.
x / temp3.
z;
200 p_.
y = temp3.
y / temp3.
z;
215 x = int(pn1.
x + 0.5f);
216 y = int(pn1.
y + 0.5f);
224 x = int(pn2.
x + 0.5f);
225 y = int(pn2.
y + 0.5f);
251 if (++nPoints == nMaxPoints)
274 delete [] pPointList3d;
275 delete [] pPointList2d;
276 delete [] pPointList2dProjection;
Implementation of an alternative to the POSIT algorithm.
void Init(const CCalibration *pCalibration)
int width
The width of the image in pixels.
int m_nPixelsSearchDistance
Data structure for the representation of a 3D vector.
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
float Length(const Vec3d &vec)
unsigned char * pixels
The pointer to the the pixels.
const CCameraParameters & GetCameraParameters() const
Gives access to the camera parameters.
float Distance(const Vec2d &vector1, const Vec2d &vector2)
bool DetermineAffineTransformation(const Vec2d *pSourcePoints, const Vec2d *pTargetPoints, int nPoints, Mat3d &A, bool bUseSVD=false)
Determines an affine transformation based on a set of 2d-2d point correspondences.
bool EstimatePose(const Vec2d *pImagePoints, Mat3d &rotationMatrix, Vec3d &translationVector, const CCalibration *pCalibration, int nMaxIterations=350)
void SetVec(Vec3d &vec, float x, float y, float z)
void MulVecScalar(const Vec3d &vec, float scalar, Vec3d &result)
bool Track(const CByteImage *pEdgeImage, Vec3d *pOutlinePoints, int nOutlinePoints, Mat3d &rotation, Vec3d &translation)
void MulMatMat(const Mat3d &matrix1, const Mat3d &matrix2, Mat3d &result)
void AddToVec(Vec3d &vec, const Vec3d &vectorToAdd)
void MulMatVec(const Mat3d &matrix, const Vec3d &vec, Vec3d &result)
void NormalizeVec(Vec2d &vec)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
int height
The height of the image in pixels.
GLenum GLsizei GLsizei height
void AddToVec(Vec2d &vec, const Vec2d &vectorToAdd)
ImageType type
The type of the image.
void NormalizeVec(Vec3d &vec)
Data structure for the representation of a 2D vector.
void SubtractVecVec(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
const CCalibration * m_pCalibration
void SetVec(Vec2d &vec, float x, float y)
void SubtractFromVec(Vec2d &vec, const Vec2d &vectorToSubtract)
void SetMat(Mat3d &matrix, float r1, float r2, float r3, float r4, float r5, float r6, float r7, float r8, float r9)
Data structure for the representation of a 3x3 matrix.
Camera model parameters and functions for a single camera.
void WorldToImageCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters=true) const
Transforms 3D world coordinates to 2D image coordinates.