The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
Viz notebook
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
im_path = Path(r'/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/')
mask_path = Path(r'/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_masks/')
#im_path = Path(r'/home/hasan/workspace/data/microscopy_data/patch_images/')
#mask_path = Path(r'/home/hasan/workspace/data/microscopy_data/patch_masks')
images=im_path.ls()
masks=mask_path.ls()
array([ 0, 255], dtype=uint8)
overlay_mask (im_path, msk_path, overlay_clr=(0, 1, 0), scale=1, alpha=0.5)
Creaete a overlay image from image and mask
overlay_mask_border_on_image (im_path, msk_path, border_color=(0, 1, 0), border_width=1)
*Overlays the border of a binary mask on a grayscale image and displays the result using matplotlib.
Args: image (numpy.ndarray): Grayscale image. mask (numpy.ndarray): Binary mask of the same size as the image. border_color (tuple): RGB color for the mask border in the range [0, 1]. border_width (int): Width of the border.
Returns: None: The function displays a plot.*
#yolo_mask_path = Path(r'/home/hasan/workspace/data/microscopy_data/yolo_dataset_train')
#im_path = Path(r'/home/hasan/workspace/data/microscopy_data/patch_images/')
yolo_mask_path = Path(r'/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train')
im_path = Path(r'/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/')
yolo_mask_path.ls(), im_path.ls()
((#1633) [Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_139_p_11.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_48_p_0.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_120_p_1.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_54_p_9.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_2_p_2.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_34_p_10.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_50_p_1.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_42_p_8.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_67_p_1.txt'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_20_p_1.txt')...],
(#1642) [Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_162_p_9.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_11_p_9.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_70_p_5.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_67_p_1.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_74_p_9.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_16_p_5.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_23_p_1.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_112_p_6.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_121_p_11.png'),Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_152_p_1.png')...])
(Path('/home/hasan/Schreibtisch/projects/data/microscopy/yolo_dataset_train/img_27_p_0.txt'),
Path('/home/hasan/Schreibtisch/projects/data/microscopy/patch_train_images/img_73_p_6.png'))
overlay_yolo_mask (im_path, msk_path, color=None, idx=None, im_name=None, fill=False, alpha=0.3)
Creaete a overlay image from image and mask
Type | Default | Details | |
---|---|---|---|
im_path | |||
msk_path | |||
color | NoneType | None | color values other matplotlib colors |
idx | NoneType | None | Index of image in the folder other random will be chosen |
im_name | NoneType | None | Imge name with extension |
fill | bool | False | whther to fill the mask or not |
alpha | float | 0.3 | alpha value for the mask for transparency |