80         m_nPixelsSearchDistance = 15;
 
   95         m_pCalibration = pCalibration;
 
  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];
 
  120         const unsigned char *pixels = pEdgeImage->
pixels;
 
  121         const int width = pEdgeImage->
width;
 
  122         const int height = pEdgeImage->
height;
 
  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;
 
  163                         const int nControlPoints = int(length_ / m_nPixelsDelta) - 1;
 
  164                         if (nControlPoints < 1 || nControlPoints > 10000)
 
  173                         Vec2d u_ = { p1_.
x - p2_.
x, p1_.
y - p2_.
y };
 
  177                         Vec2d n = { p1_.
y - p2_.
y, p2_.
x - p1_.
x };
 
  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;
 
  210                                 for (k = 0; k < m_nPixelsSearchDistance; k++)
 
  215                                         x = int(pn1.
x + 0.5f);
 
  216                                         y = int(pn1.
y + 0.5f);
 
  217                                         if (x > 0 && x < width && y > 0 && y < height && pixels[y * width + x])
 
  224                                         x = int(pn2.
x + 0.5f);
 
  225                                         y = int(pn2.
y + 0.5f);
 
  226                                         if (x > 0 && x < width && y > 0 && y < height && pixels[y * width + x])
 
  251                                         if (++nPoints == nMaxPoints)
 
  272         objectPose.
EstimatePose(pPointList2d, rotation, translation, m_pCalibration);
 
  274         delete [] pPointList3d;
 
  275         delete [] pPointList2d;
 
  276         delete [] pPointList2dProjection;
 
void Init(const CCalibration *pCalibration)
Data structure for the representation of a 2D vector. 
void NormalizeVec(Vec2d &vec)
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. 
float Length(const Vec3d &vec)
void WorldToImageCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters=true) const 
Transforms 3D world coordinates to 2D image coordinates. 
const CCameraParameters & GetCameraParameters() const 
Gives access to the camera parameters. 
void NormalizeVec(Vec3d &vec)
void SubtractVecVec(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
void MulMatMat(const Mat3d &matrix1, const Mat3d &matrix2, Mat3d &result)
Implementation of an alternative to the POSIT algorithm. 
void SubtractFromVec(Vec2d &vec, const Vec2d &vectorToSubtract)
ImageType type
The type of the image. 
int width
The width of the image in pixels. 
int height
The height of the image in pixels. 
Data structure for the representation of a 3D vector. 
void MulMatVec(const Mat3d &matrix, const Vec3d &vec, Vec3d &result)
void SetMat(Mat3d &matrix, float r1, float r2, float r3, float r4, float r5, float r6, float r7, float r8, float r9)
Camera model parameters and functions for a single camera. 
unsigned char * pixels
The pointer to the the pixels. 
bool EstimatePose(const Vec2d *pImagePoints, Mat3d &rotationMatrix, Vec3d &translationVector, const CCalibration *pCalibration, int nMaxIterations=350)
float Distance(const Vec2d &vector1, const Vec2d &vector2)
void AddToVec(Vec3d &vec, const Vec3d &vectorToAdd)
Data structure for the representation of a 3x3 matrix. 
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
void SetVec(Vec2d &vec, float x, float y)
bool Track(const CByteImage *pEdgeImage, Vec3d *pOutlinePoints, int nOutlinePoints, Mat3d &rotation, Vec3d &translation)
void MulVecScalar(const Vec3d &vec, float scalar, Vec3d &result)
void AddToVec(Vec2d &vec, const Vec2d &vectorToAdd)
void SetVec(Vec3d &vec, float x, float y, float z)