upsp.cam_cal_utils.visualization

axisEqual3D(ax)[source]

In a 3D plot, equalizes all axes to same scale

plot_coord_sys(rmat, tvec, ax, scale=10, text=None)[source]

Given a pose, plots the basis of that coordinate system in the given matplotlib axis

In the plot, the x axis is blue, the y axis is orange, and the z axis is green

Parameters
  • rmat (array_like, shape (3, 3)) – Rotation Matrix. Columns represent the basis of the coordinate system

  • tvec (array_like, , shape (3,)) – Origin of the coordinate system

  • ax (mpl_toolkits.mplot3d.axes3d.Axes3D) – matplotlib axis

  • scale (int or float, optional) – Size of the vcoordinate system vectors

  • text (str, optional) – Label of the coordinate system. If None (default), no text is added.

plot_pts_and_norms(pts_and_norms, ax, scale=5, c='r')[source]

Helper function to plot points with normals

Parameters
  • pts_and_norms (list of dict) – Each dictionary has keys ‘tvec’ and ‘norm’ tvec refers to the translation vector from the origin to the point norm refers to the point’s normal vector

  • ax (mpl_toolkits.mplot3d.axes3d.Axes3D) – matplotlib axis

  • scale (int or float, optional) – Size of the normal vectors

  • c (str, optional) – Color of points and normals

show_coord_transforms(cs1_rmat, cs1_tvec, cs2_rmat, cs2_tvec, figname=None, texts=[None, None, None], compares=[False, False, False])[source]

Shows the transformation from coordinate system 1 (cs1) to coordinate system 2 (cs2)

Additionally, shows the origin coordinate system. Draws a line from cs1 to cs2 Texts is the label to be shown for the origin, cs1, and cs2 respectively compares is a list of booleans that determines if a line is drawn from the origin to cs1 (compares[0]), from cs1 to cs2 (compares[1]), and from cs2 to the origin (compares[2])

show_image_locations(img, img_locations, fig_name, scale=5, c='w')[source]

Displays an image with the given image locations indicated with a marker of the given color (white by default)

show_projection_matching(img, proj_pts, matching_points, num_matches=None, name='', bonus_pt=None, scale=10.0, ax=None)[source]

Show the projected target matching.

Projected points are labeled in red. Matching points are labeled in white. Line connecting point to match is drawn in black

Parameters
  • img (array_like) – Display image

  • proj_pts (array_like, shape (n, 2)) – :rojected locations of 3D points

  • matching_points (array_like, shape (n, 2)) – Image location of point

  • name (str, optinoal) – Figure name prefix

  • bonus_pt (array_like, optional) – Optional input. Point to be shown in blue

  • scale (int or float, optional) – Scale of point labels

show_pts_and_norms(rmat, tvec, pts_and_norms, ax=None, c='r', texts=(None, None))[source]

Helper function to plot transformation from the origin to given coordinate system, and show a set of points. Originally intended to plot the tgts frame and the targets with their normals

Parameters
  • rmat (array_like, shape (3, 3)) – Basis of the coordinate system to be shown

  • tvec (array_like, shape (3,)) – Origin of coordinate system to be shown

  • pts_and_norms (list of dict) – Each dictionary has keys ‘tvec’ and ‘norm’ tvec refers to the translation vector from the origin to the point norm refers to the point’s normal vector. Points and normals are in the coordinate frame of the origin

  • ax (matplotlib.Axes, optional) – matplotlib axis. If not provided, a figure and 3D axes are created.

  • scale (int or float) – Size of the normal vectors

  • c (str, optional) – Color of points and normals

  • texts (tuple, optional) – Labels for the origin and transformed coordinate system.