upsp.intensity_mapping.node_pixel_mapping

node_to_pixel_mapping_keyframe(rmat, tvec, cameraMatrix, distCoeffs, vis_checker, nodes, normals)[source]

Returns data on the projected visible nodes for a keyframe

Returns a numpy array of the pixel positions of the projected locations of the visible nodes. Additionally returns the gradient of the pixel position with respect to the rotation vector and translation vector. Non-visible nodes are given a pixel position and gradient value of NAN. Additionally returns a sorted numpy array of the indices of the nodes that are visible.

Parameters
  • rmat (numpy.ndarray, shape (3, 3), float) – The rotation matrix from the camera to the model

  • tvec (numpy.ndarray, shape (3, 1), float) – The translation vector from the camera to the model

  • cameraMatrix (numpy.ndarray, shape (3, 3), float) – The (openCV formatted) camera matrix for the camera

  • distCoeffs (numpy.ndarray, shape (5, 1) or (5,), float) – The (openCV formatted) distortion coefficients for the camera

  • vis_checker (VisibilityChecker) – VisibilityChecker object with the relevant BVH and oblique viewing angle

  • nodes (numpy.ndarray, shape (N, 3), float) – A numpy array of the X, Y, and Z values of the nodes. nodes[n] is associated with normals[n]

  • normals (numpy.ndarray, shape (N, 3), float) – A numpy array of the i, j, and k values of the node normals. normals[n] is associated with nodes[n]

Returns

  • projections (numpy.ndarray, shape (N, 2), float) – Pixel locations of the projected nodes. Non-visibles nodes will be NAN. projections[i] is associated with nodes[i] and jacobian[i]

  • jacobians (numpy.ndarray, shape (N, 2, 6), float) – Jacobian of pixel locations of the projected nodes. Non-visibles nodes will be NAN. Jacobian axis 2 refers to (rvec | tvec). jacobian[i] is associated with nodes[i] and projections[i]

  • visible_indices (numpy.ndarray, shape (V,), int) – Sorted numpy array of the indices of the visibles nodes

See also

node_to_pixel_mapping_non_keyframe

use outputs to quickly map non-keyframes

node_to_pixel_mapping_non_keyframe(rmat_key, tvec_key, rmat_curr, tvec_curr, projs, jacs, vis_idxs)[source]

Returns data on the projected visible nodes for a non-keyframe

Returns a numpy array of the pixel positions of the projected locations of the visible nodes. Non-visible nodes are given a pixel position of NAN. Assumes set of nodes visible in keyframe is same for nearby non-keyframes. Uses the Jacobian to quickly approximate the projected location

Parameters
  • rmat_key (numpy.ndarray, shape (3, 3), float) – The rotation matrix from the camera to the model of the keyframe

  • tvec_key (numpy.ndarray, shape (3, 1), float) – The translation vector from the camera to the model of the keyframe

  • rmat_curr (numpy.ndarray, shape (3, 3), float) – The rotation matrix from the camera to the model of the current non-keyframe

  • tvec_curr (numpy.ndarray, shape (3, 1) or (3,), float) – The translation vector from the camera to the model of the current non-keyframe

  • projs (numpy.ndarray, shape (N, 2), float) – Projected locations of the nodes in the keyframe

  • jacs (numpy.ndarray, shape (N, 2, 6), float) – Jacobians of the projected locations

  • vis_idxs (numpy.ndarray, shape (V,), float) – Indices of the visible nodes.

Returns

updated_projections – Approximate pixel locations of the projected nodes. Non-visibles nodes will be NAN. updated_projections[i] is associated with projs[i]

Return type

numpy.ndarray, shape (N, 2), float

See also

node_to_pixel_mapping_keyframe

create keyframe inputs

node_to_pixel_mapping_non_keyframe_full(rmat, tvec, cameraMatrix, distCoeffs, nodes, vis_idxs)[source]

Returns data on the projected visible nodes for a non-keyframe

Returns a numpy array of the pixel positions of the projected locations of the visible nodes. Non-visible nodes are given a pixel position of NAN. Assumes set of nodes visible in keyframe is same for nearby non-keyframes. Fully computes the projection

Parameters
  • rmat (numpy.ndarray, shape (3, 3), float) – The rotation matrix from the camera to the model of the current non-keyframe

  • tvec (numpy.ndarray, shape (3, 1), float) – The translation vector from the camera to the model of the current non-keyframe

  • cameraMatrix (numpy.ndarray, shape (3, 3), float) – The (openCV formatted) camera matrix for the camera

  • distCoeffs (numpy.ndarray, shape (5, 1) or (5,), float) – The (openCV formatted) distortion coefficients for the camera

  • nodes (numpy.ndarray, shape (N, 3), float) – A numpy array of the X, Y, and Z values of the nodes. nodes[n] is associated with normals[n]

  • vis_idxs (numpy.ndarray, shape (V,), float) – Indices of the visible nodes

Returns

updated_projections – Pixel locations of the projected nodes. Non-visibles nodes will be NAN. updated_projections[i] is associated with nodes[i]

Return type

numpy.ndarray, shape (N, 2), float

See also

node_to_pixel_mapping_keyframe

create vis_idxs based on a keyframe