Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2.projectPoints jacobians columns

Documentation of cv2.projectPoints states:

jacobian – Optional output 2Nx(10+<numdistcoeffs>) jacobian matrix of derivatives of image points with respect to components of the rotation vector, translation vector, focal lengths, coordinates of the principal point and the distortion coefficients. In the old interface different components of the jacobian are returned via different output parameters.

I have found while digging in sources next info:

  • dp/drot must be 2Nx3 floating-point matrix
  • dp/dT must be 2Nx3 floating-point matrix
  • dp/df must be 2Nx2 floating-point matrix
  • dp/dc must be 2Nx2 floating-point matrix
  • dp/df must be 2Nx14, 2Nx12, 2Nx8, 2Nx5, 2Nx4 or 2Nx2 floating-point matrix

And:

    _jacobian.create(npoints*2, 3+3+2+2+ndistCoeffs, CV_64F);
    Mat jacobian = _jacobian.getMat();
    pdpdrot = &(dpdrot = jacobian.colRange(0, 3));
    pdpdt = &(dpdt = jacobian.colRange(3, 6));
    pdpdf = &(dpdf = jacobian.colRange(6, 8));
    pdpdc = &(dpdc = jacobian.colRange(8, 10));
    pdpddist = &(dpddist = jacobian.colRange(10, 10+ndistCoeffs));

That is strange for me that it is not clearly documented, e.g. I initially thought that it goes as dx,dy,dz,droll,dpitch,dyaw..., but anyway.

What is a complete order of derivatives? Especially for:

  • pdpdrot: droll, dpitch, dyaw or dyaw, dpitch, droll
  • dp/dt: dx,dy?
  • dp/df: dfx, dfy?
  • dp/dc: dcx, dcy?

cv2.projectPoints jacobians columnscolumns order

Documentation of cv2.projectPoints states:

jacobian – Optional output 2Nx(10+<numdistcoeffs>) jacobian matrix of derivatives of image points with respect to components of the rotation vector, translation vector, focal lengths, coordinates of the principal point and the distortion coefficients. In the old interface different components of the jacobian are returned via different output parameters.

I have found while digging in sources next info:

  • dp/drot must be 2Nx3 floating-point matrix
  • dp/dT must be 2Nx3 floating-point matrix
  • dp/df must be 2Nx2 floating-point matrix
  • dp/dc must be 2Nx2 floating-point matrix
  • dp/df must be 2Nx14, 2Nx12, 2Nx8, 2Nx5, 2Nx4 or 2Nx2 floating-point matrix

And:

    _jacobian.create(npoints*2, 3+3+2+2+ndistCoeffs, CV_64F);
    Mat jacobian = _jacobian.getMat();
    pdpdrot = &(dpdrot = jacobian.colRange(0, 3));
    pdpdt = &(dpdt = jacobian.colRange(3, 6));
    pdpdf = &(dpdf = jacobian.colRange(6, 8));
    pdpdc = &(dpdc = jacobian.colRange(8, 10));
    pdpddist = &(dpddist = jacobian.colRange(10, 10+ndistCoeffs));

That is strange for me that it is not clearly documented, e.g. I initially thought that it goes as dx,dy,dz,droll,dpitch,dyaw..., but anyway.

What is a complete order of derivatives? Especially for:

  • pdpdrot: droll, dpitch, dyaw or dyaw, dpitch, droll
  • dp/dt: dx,dy?
  • dp/df: dfx, dfy?
  • dp/dc: dcx, dcy?