Visualisation

This module contains different functions to draw coordinates and orientations on images.

draw_arrows(img, positions, angles, color=(0, 0, 255), line_width=6, arrow_length=150)[source][source]

Draw arrows from positions in angle direction (clockwise).

(The 0°-Angle is the x-Axis.)

Parameters:
  • img (ndarray) – Image (min. 3 channel) to draw on.
  • positions (ndarray) – The points the arrows starts from. (N,2)
  • angles (ndarray) – Angles in rad (length (N,)).
draw_circles(img, centres, radius=32, color=(0, 0, 255), line_width=6)[source][source]

Draw circles around positions.

Parameters:
  • img (ndarray) – Image (min. 3 channel) to draw on.
  • centres (ndarray) – The centres of the circles. (N,2)
  • radius – Radius of the circles.
draw_marks(img, positions, color=(0, 0, 255), marker_types=<MagicMock id='140326648330112'>)[source][source]

Draw cross marks on position.

Parameters:
  • img (ndarray) – Image (min. 3 channel) to draw on.
  • positions (ndarray) – The points to mark. (N,2)
draw_complex_marks(img, centres, angles, color=(0, 0, 255), marker_types=<MagicMock id='140326648338528'>)[source][source]

Draw more complex marks, with circles, marked centres and arrows for angles/direction.

Parameters:
  • img (ndarray) – Image (min. 3 channel) to draw on.
  • centres (ndarray) – The centres of the marks and starting points of arrows. (N,2)
  • angles (ndarray) – Angles in rad (length (N,)).
draw_grid(image, origin, ratio_px_mm, step_size_mm=8)[source][source]

Draw a grid with axes in mm on the image.

Parameters:
  • image (ndarray) – Image to draw on.
  • origin (ndarray) – The orgin of the grid / axes.
  • ratio_px_mm – Ratio to convert pixel to mm.
  • step_size_mm – The (step) distance between the grid lines.