cvtools.utils.image module¶
-
cvtools.utils.image.
draw_boxes_texts
(img, boxes, texts=None, colors=None, line_width=1, draw_start=False, box_format='x1y1x2y2')[源代码]¶ Draw bboxes on an image.
参数: - img (str or ndarray) -- The image to be displayed.
- boxes (list or ndarray) -- A list of ndarray of shape (k, 4).
- texts (list) -- A list of shape (k).
- colors (list[tuple or Color]) -- A list of colors.
- line_width (int) -- Thickness of lines.
- draw_start (bool) -- Draw a dot at the first vertex of the box.
- box_format (str) -- x1y1x2y2(default), x1y1wh, xywh, xywha, polygon
-
cvtools.utils.image.
draw_class_distribution
(y, save_name='class_distribution.png')[源代码]¶ 绘制饼图,其中y是标签列表
-
cvtools.utils.image.
draw_hist
(data, bins=10, x_label='区间', y_label='频数/频率', title='频数/频率分布直方图', show=True, save_name='hist.png', density=True)[源代码]¶ 绘制直方图 data: 必选参数,绘图数据 bins: 直方图的长条形数目,可选项,默认为10
-
cvtools.utils.image.
imread
(img_or_path, flag='color')[源代码]¶ Read an image.
参数: - img_or_path (ndarray or str) -- Either a numpy array or image path. If it is a numpy array (loaded image), then it will be returned as is.
- flag (str) -- Flags specifying the color type of a loaded image, candidates are color, grayscale and unchanged.
返回: Loaded image array.
返回类型: ndarray
-
cvtools.utils.image.
imwrite
(img, file_path, params=None, auto_mkdir=True)[源代码]¶ Write image to file
参数: - img (ndarray) -- Image array to be written.
- file_path (str) -- Image file path.
- params (None or list) -- Same as opencv's
imwrite()
interface. - auto_mkdir (bool) -- If the parent folder of file_path does not exist, whether to create it automatically.
返回: Successful or not.
返回类型: bool