easycv.core.visualization package

easycv.core.visualization.imshow_bboxes(img, bboxes, labels=None, colors='green', text_color='white', font_size=20, thickness=1, font_scale=0.5, show=True, win_name='', wait_time=0, out_file=None)[source]

Draw bboxes with labels (optional) on an image. This is a wrapper of mmcv.imshow_bboxes.

Parameters
  • img (str or ndarray) – The image to be displayed.

  • bboxes (ndarray) – ndarray of shape (k, 4), each row is a bbox in format [x1, y1, x2, y2].

  • labels (str or list[str], optional) – labels of each bbox.

  • colors (list[str or tuple or Color]) – A list of colors.

  • text_color (str or tuple or Color) – Color of texts.

  • font_size (int) – Size of font.

  • thickness (int) – Thickness of lines.

  • font_scale (float) – Font scales of texts.

  • show (bool) – Whether to show the image.

  • win_name (str) – The window name.

  • wait_time (int) – Value of waitKey param.

  • out_file (str, optional) – The filename to write the image.

Returns

The image with bboxes drawn on it.

Return type

ndarray

easycv.core.visualization.imshow_keypoints(img, pose_result, skeleton=None, kpt_score_thr=0.3, pose_kpt_color=None, pose_link_color=None, radius=4, thickness=1, show_keypoint_weight=False)[source]

Draw keypoints and links on an image.

Parameters
  • img (str or Tensor) – The image to draw poses on. If an image array is given, id will be modified in-place.

  • pose_result (list[kpts]) – The poses to draw. Each element kpts is a set of K keypoints as an Kx3 numpy.ndarray, where each keypoint is represented as x, y, score.

  • kpt_score_thr (float, optional) – Minimum score of keypoints to be shown. Default: 0.3.

  • pose_kpt_color (np.array[Nx3]`) – Color of N keypoints. If None, the keypoint will not be drawn.

  • pose_link_color (np.array[Mx3]) – Color of M links. If None, the links will not be drawn.

  • thickness (int) – Thickness of lines.

easycv.core.visualization.imshow_label(img, labels, text_color='blue', font_size=20, thickness=1, font_scale=0.5, intervel=5, show=True, win_name='', wait_time=0, out_file=None)[source]

Draw images with labels on an image.

Parameters
  • img (str or ndarray) – The image to be displayed.

  • labels (str or list[str]) – labels of each image.

  • text_color (str or tuple or Color) – Color of texts.

  • font_size (int) – Size of font.

  • thickness (int) – Thickness of lines.

  • font_scale (float) – Font scales of texts.

  • intervel(int) – interval pixels between multiple labels

  • show (bool) – Whether to show the image.

  • win_name (str) – The window name.

  • wait_time (int) – Value of waitKey param.

  • out_file (str, optional) – The filename to write the image.

Returns

The image with bboxes drawn on it.

Return type

ndarray

Submodules

easycv.core.visualization.image module

easycv.core.visualization.image.get_font_path()[source]
easycv.core.visualization.image.put_text(img, xy, text, fill, size=20)[source]

support chinese text

easycv.core.visualization.image.imshow_label(img, labels, text_color='blue', font_size=20, thickness=1, font_scale=0.5, intervel=5, show=True, win_name='', wait_time=0, out_file=None)[source]

Draw images with labels on an image.

Parameters
  • img (str or ndarray) – The image to be displayed.

  • labels (str or list[str]) – labels of each image.

  • text_color (str or tuple or Color) – Color of texts.

  • font_size (int) – Size of font.

  • thickness (int) – Thickness of lines.

  • font_scale (float) – Font scales of texts.

  • intervel(int) – interval pixels between multiple labels

  • show (bool) – Whether to show the image.

  • win_name (str) – The window name.

  • wait_time (int) – Value of waitKey param.

  • out_file (str, optional) – The filename to write the image.

Returns

The image with bboxes drawn on it.

Return type

ndarray

easycv.core.visualization.image.imshow_bboxes(img, bboxes, labels=None, colors='green', text_color='white', font_size=20, thickness=1, font_scale=0.5, show=True, win_name='', wait_time=0, out_file=None)[source]

Draw bboxes with labels (optional) on an image. This is a wrapper of mmcv.imshow_bboxes.

Parameters
  • img (str or ndarray) – The image to be displayed.

  • bboxes (ndarray) – ndarray of shape (k, 4), each row is a bbox in format [x1, y1, x2, y2].

  • labels (str or list[str], optional) – labels of each bbox.

  • colors (list[str or tuple or Color]) – A list of colors.

  • text_color (str or tuple or Color) – Color of texts.

  • font_size (int) – Size of font.

  • thickness (int) – Thickness of lines.

  • font_scale (float) – Font scales of texts.

  • show (bool) – Whether to show the image.

  • win_name (str) – The window name.

  • wait_time (int) – Value of waitKey param.

  • out_file (str, optional) – The filename to write the image.

Returns

The image with bboxes drawn on it.

Return type

ndarray

easycv.core.visualization.image.imshow_keypoints(img, pose_result, skeleton=None, kpt_score_thr=0.3, pose_kpt_color=None, pose_link_color=None, radius=4, thickness=1, show_keypoint_weight=False)[source]

Draw keypoints and links on an image.

Parameters
  • img (str or Tensor) – The image to draw poses on. If an image array is given, id will be modified in-place.

  • pose_result (list[kpts]) – The poses to draw. Each element kpts is a set of K keypoints as an Kx3 numpy.ndarray, where each keypoint is represented as x, y, score.

  • kpt_score_thr (float, optional) – Minimum score of keypoints to be shown. Default: 0.3.

  • pose_kpt_color (np.array[Nx3]`) – Color of N keypoints. If None, the keypoint will not be drawn.

  • pose_link_color (np.array[Mx3]) – Color of M links. If None, the links will not be drawn.

  • thickness (int) – Thickness of lines.