Create a mask. Args: image (`PIL.Image.Image`): The image input, should be a PIL image. Returns: `PIL.Image.Image`: The binarized image. Values less than 0.5 are set to 0, values greater than 0.5 are set to 1.
(self, image: PIL.Image.Image)
| 407 | return image |
| 408 | |
| 409 | def binarize(self, image: PIL.Image.Image) -> PIL.Image.Image: |
| 410 | """ |
| 411 | Create a mask. |
| 412 | |
| 413 | Args: |
| 414 | image (`PIL.Image.Image`): |
| 415 | The image input, should be a PIL image. |
| 416 | |
| 417 | Returns: |
| 418 | `PIL.Image.Image`: |
| 419 | The binarized image. Values less than 0.5 are set to 0, values greater than 0.5 are set to 1. |
| 420 | """ |
| 421 | image[image < 0.5] = 0 |
| 422 | image[image >= 0.5] = 1 |
| 423 | |
| 424 | return image |
| 425 | |
| 426 | def get_default_height_width( |
| 427 | self, |
no outgoing calls
no test coverage detected