|
Safemotion Lib
|
Functions | |
| display_reid_result (sorted_keep_index, crop_image_path, test_image_list) | |
| get_palette (n) | |
| vis_instance_segmentation (image, masks=None, bboxes=None, colors=None) | |
| vis_pose_coco_skeleton (image, pose_results) | |
| vis_pose_coco_skeleton_one_person (image, keypoints) | |
| draw_single_bbox_and_label (img, bbox, label, box_color, box_thk, txt_color, txt_thk, txt_scale, box_type='xywh') | |
| draw_bboxes_list (image, bboxes, box_color, box_thk, box_type, labels=None) | |
| draw_bboxes_dict (image, bboxes, box_color, box_thk, box_type) | |
| draw_and_save_bboxes (image, save_path, bboxes, box_color, box_thk, box_type='xywh') | |
| draw_and_save_single_bbox (image, save_path, bbox, label, box_color, box_thk, box_type='xywh') | |
| make_video (folder_or_paths, save_path, fps=30, i_size='half') | |
| utils_vis.display_reid_result | ( | sorted_keep_index, | |
| crop_image_path, | |||
| test_image_list ) |
Definition at line 7 of file utils_vis.py.
| utils_vis.draw_and_save_bboxes | ( | image, | |
| save_path, | |||
| bboxes, | |||
| box_color, | |||
| box_thk, | |||
| box_type = 'xywh' ) |
박스를 그리고 박스가 그려진 이미지를 저장하는 기능
args:
image (str or np.array): 이미지 경로 또는 이미지
save_path (str): 이미지 저장 경로
bboxes (np.array or list[np.array] or dict): 박스
box_color (tuple): 박스 컬러
box_thk (int): 박스를 그리는 선의 두께
box_type (str): 박스 구조, 'xyxy', 'xywh' 지원
Definition at line 227 of file utils_vis.py.
| utils_vis.draw_and_save_single_bbox | ( | image, | |
| save_path, | |||
| bbox, | |||
| label, | |||
| box_color, | |||
| box_thk, | |||
| box_type = 'xywh' ) |
박스 한개를 그리고 박스가 그려진 이미지를 저장하는 기능
args:
image (str or np.array): 이미지 경로 또는 이미지
save_path (str): 이미지 저장 경로
bbox (np.array): 박스, shape (4 or 5 or 6)
label (str): 출력 문구
box_color (tuple): 박스 컬러
box_thk (int): 박스를 그리는 선의 두께
box_type (str): 박스 구조, 'xyxy', 'xywh' 지원
Definition at line 252 of file utils_vis.py.
| utils_vis.draw_bboxes_dict | ( | image, | |
| bboxes, | |||
| box_color, | |||
| box_thk, | |||
| box_type ) |
딕셔너리 형태로 입력된 박스를 그리는 기능
키는 추적 아이디, value는 박스
args:
image (np.array): 이미지
bboxes (dict[np.array]): 박스
box_color (tuple): 박스 컬러
box_thk (int): 박스를 그리는 선의 두께
box_type (str): 박스 구조, 'xyxy', 'xywh' 지원
return (np.array): 박스가 그려진 이미지
Definition at line 210 of file utils_vis.py.
| utils_vis.draw_bboxes_list | ( | image, | |
| bboxes, | |||
| box_color, | |||
| box_thk, | |||
| box_type, | |||
| labels = None ) |
리스트 또는 np.array 타입의 박스를 이미지에 그리는 기능
args:
image (np.array): 이미지
bboxes (list[np.array], np.array): 박스
box_color (tuple): 박스 컬러
box_thk (int): 박스를 그리는 선의 두께
box_type (str): 박스 구조, 'xyxy', 'xywh' 지원
labels (str): 출력 문구
return (np.array): 박스 및 텍스트가 그려진 이미지
Definition at line 182 of file utils_vis.py.
| utils_vis.draw_single_bbox_and_label | ( | img, | |
| bbox, | |||
| label, | |||
| box_color, | |||
| box_thk, | |||
| txt_color, | |||
| txt_thk, | |||
| txt_scale, | |||
| box_type = 'xywh' ) |
이미지에 박스 한개와 텍스트를 출력하는 기능
텍스트의 위치는 박스의 상단, 상단에 출력하지 못할것 같다고 판단되면 박스 하단에 출력
args:
img (np.array): 이미지
bbox (np.array): 박스, shape (4 or 5)
label (str): 출력 문구
box_color (tuple): 박스 컬러
box_thk (int): 박스를 그리는 선의 두께
txt_color (tuple): 텍스트의 색상
txt_thk (int): 텍스트 선의 두께
txt_scale (float): 텍스트의 크기
box_type (str): 박스 구조, 'xyxy', 'xywh' 지원
return (np.array): 박스 및 텍스트가 그려진 이미지
Definition at line 145 of file utils_vis.py.
| utils_vis.get_palette | ( | n | ) |
설정한 수량만큼 컬러 테이블을 생성하는 기능
args:
n (int): 생성하려는 색상 수량
return (list[tuple]): 컬러 테이블
Definition at line 11 of file utils_vis.py.
| utils_vis.make_video | ( | folder_or_paths, | |
| save_path, | |||
| fps = 30, | |||
| i_size = 'half' ) |
이미지를 기반으로 동영상을 생성하는 기능
TODO: utils_video.py의 make_video를 사용하도록 함, 제거 필요
args:
folder_or_paths (str or list[str]): 동영상을 만들 이미지가 저장된 폴더 또는 이미지 경로 리스트
save_path (str): 동영상을 저장할 경로
fps (int): 생성할 동영상의 프레임 속도
i_size (str): 이미지의 크기를 절반으로 줄여서 저장할지 여부, 'half'입력했을 경우 영상을 절반 크기로 생성함
Definition at line 279 of file utils_vis.py.
| utils_vis.vis_instance_segmentation | ( | image, | |
| masks = None, | |||
| bboxes = None, | |||
| colors = None ) |
Instance Segmentation 결과 시각화를 위한 기능
박스 또는 마스크 둘중 하나 이상은 입력되어야함
args:
image (np.array): 이미지
masks (list[np.array]): Instance Mask, 각 마스크의 shape은 이미지의 크기와 동일함
bboxes (np.array): 검출 객체의 박스, 순서는 마스크와 매칭되어야함
colors (list[tuple]): 컬러 테이블
return (np.array): Instance Segmentation 결과가 시각화된 이미지
TODO: 이미지를 리턴하지 않아도 됨, 리턴 제거
Definition at line 25 of file utils_vis.py.
| utils_vis.vis_pose_coco_skeleton | ( | image, | |
| pose_results ) |
coco 스켈레톤을 시각화하는 기능
args:
image (np.array): 이미지
pose_results (list[dict] or dict): 스켈레톤 정보를 담고 'keypoints'가 포함된 데이터 리스트
return (np.array): coco 스켈레톤이 시각화된 이미지
Definition at line 65 of file utils_vis.py.
| utils_vis.vis_pose_coco_skeleton_one_person | ( | image, | |
| keypoints ) |
한명에 대한 coco 스켈레톤을 시각화 하는 기능
args:
image (np.array): 이미지
keypoints (np.array): 한명에 대한 스켈레톤 좌표, shape (17, 3)
return (np.array): 스켈레톤이 시각화된 이미지
Definition at line 86 of file utils_vis.py.