Crop borders of images. Args: imgs (list[ndarray] | ndarray): Images with shape (h, w, c). crop_border (int): Crop border for each end of height and weight. Returns: list[ndarray]: Cropped images.
(imgs, crop_border)
| 154 | |
| 155 | |
| 156 | def crop_border(imgs, crop_border): |
| 157 | """Crop borders of images. |
| 158 | |
| 159 | Args: |
| 160 | imgs (list[ndarray] | ndarray): Images with shape (h, w, c). |
| 161 | crop_border (int): Crop border for each end of height and weight. |
| 162 | |
| 163 | Returns: |
| 164 | list[ndarray]: Cropped images. |
| 165 | """ |
| 166 | if crop_border == 0: |
| 167 | return imgs |
| 168 | else: |
| 169 | if isinstance(imgs, list): |
| 170 | return [v[crop_border:-crop_border, crop_border:-crop_border, ...] for v in imgs] |
| 171 | else: |
| 172 | return imgs[crop_border:-crop_border, crop_border:-crop_border, ...] |
nothing calls this directly
no outgoing calls
no test coverage detected