100 printf(
"error: input image must be grayscale image for CRAPiD::Track\n");
107 printf(
"error: calibration does not match image in CRAPiD::Track\n");
117 for (
int i = 0; i < nOutlinePoints; i += 2)
137 if (nControlPoints < 1)
146 Vec2d u_ = { p1_.
x - p2_.
x, p1_.
y - p2_.
y };
156 for (
int j = 0; j < nControlPoints; j++)
179 x = int(pn1.
x + 0.5f);
180 y = int(pn1.
y + 0.5f);
188 x = int(pn2.
x + 0.5f);
189 y = int(pn2.
y + 0.5f);
205 pRAPiDElement->
l = float(l);
225 printf(
"error: not enough input points for RAPiD::RAPiD\n");
239 const int nPoints = elementList.
GetSize();
252 for (i = 0; i < nPoints; i++)
263 const float xc = x + t.
x;
264 const float yc = y + t.
y;
265 const float zc = z + t.
z;
267 const float u0 = fx * xc / zc;
268 const float v0 = fy * yc / zc;
270 const float nx = pElement->
n.
x;
271 const float ny = pElement->
n.
y;
273 const float c1 = (-nx * u0 * y - ny * (fy * z + v0 *
y)) / zc;
274 const float c2 = (nx * (fx * z + u0 *
x) + ny * v0 * x) / zc;
275 const float c3 = (-nx * fx * y + ny * fy *
x) / zc;
276 const float c4 = (nx * fx) / zc;
277 const float c5 = (ny * fy) / zc;
278 const float c6 = (-nx * u0 - ny *
v0) / zc;
280 const float l = pElement->
l;
311 for (i = 0; i < nPoints; i++)
334 delete [] pNewPoints;
Struct containing all parameters of the camera model.
Mat3d m_rotation_inverse
Rotation matrix of the inverted extrinsic transformation.
void CrossProduct(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
GLdouble GLdouble GLdouble GLdouble q
int width
The width of the image in pixels.
void AddToMat(CFloatMatrix *pMatrix, const CFloatMatrix *pMatrixToAdd)
CDynamicArrayElement * GetElement(int nElement)
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)
void MulVecScalar(const Vec2d &vec, float scalar, Vec2d &result)
void SolveLinearLeastSquaresSVD(const CFloatMatrix *A, const CFloatVector *b, CFloatVector *x)
unsigned char * pixels
The pointer to the the pixels.
void Init(const CCalibration *pCalibration)
bool AddElement(CDynamicArrayElement *pElement, bool bAddUniqueOnly=false, bool bManageMemory=true)
const CCameraParameters & GetCameraParameters() const
Gives access to the camera parameters.
float Distance(const Vec2d &vector1, const Vec2d &vector2)
static bool RAPiD(CDynamicArray &elementList, const CCalibration *pCalibration, Mat3d &rotation, Vec3d &translation)
void SetVec(Vec3d &vec, float x, float y, float z)
void MulVecScalar(const Vec3d &vec, float scalar, Vec3d &result)
Data structure for the representation of a matrix of values of the data type float.
void AddVecVec(const Vec3d &vector1, const Vec3d &vector2, Vec3d &result)
void MulMatMat(const Mat3d &matrix1, const Mat3d &matrix2, Mat3d &result)
void AddToVec(Vec3d &vec, const Vec3d &vectorToAdd)
static bool CalculateOptimalTransformation(const Vec3d *pSourcePoints, const Vec3d *pTargetPoints, int nPoints, Mat3d &rotation, Vec3d &translation)
void MulMatVec(const Mat3d &matrix, const Vec3d &vec, Vec3d &result)
void NormalizeVec(Vec2d &vec)
int m_nPixelsSearchDistance
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
int height
The height of the image in pixels.
void MulMatMat(const CFloatMatrix *A, const CFloatMatrix *B, CFloatMatrix *pResultMatrix, bool bTransposeB=false)
const CCalibration * m_pCalibration
Vec3d m_translation_inverse
Translation vector of the inverted extrinsic transformation.
GLfloat GLfloat GLfloat GLfloat nx
GLenum GLsizei GLsizei height
void AddToVec(Vec2d &vec, const Vec2d &vectorToAdd)
Data structure for the representation of a vector of values of the data type float.
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)
void Transpose(const CFloatMatrix *pMatrix, CFloatMatrix *pResultMatrix)
void SetVec(Vec2d &vec, float x, float y)
void SubtractFromVec(Vec2d &vec, const Vec2d &vectorToSubtract)
bool Track(const CByteImage *pEdgeImage, Vec3d *pOutlinePoints, int nOutlinePoints, Mat3d &rotation, Vec3d &translation)
void Zero(CByteImage *pImage, const MyRegion *pROI=0)
Sets all values in a CByteImage to zero.
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.