Transpose image(s) by swapping the height and width dimension. Args: image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor of shape `[height, width, channels]`. name: A name for this operation (optional). Returns: If `image` was 4-D, a 4-D float Tensor o
(image, name=None)
| 589 | |
| 590 | @tf_export('image.transpose', v1=['image.transpose', 'image.transpose_image']) |
| 591 | def transpose(image, name=None): |
| 592 | """Transpose image(s) by swapping the height and width dimension. |
| 593 | |
| 594 | Args: |
| 595 | image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor |
| 596 | of shape `[height, width, channels]`. |
| 597 | name: A name for this operation (optional). |
| 598 | |
| 599 | Returns: |
| 600 | If `image` was 4-D, a 4-D float Tensor of shape |
| 601 | `[batch, width, height, channels]` |
| 602 | If `image` was 3-D, a 3-D float Tensor of shape |
| 603 | `[width, height, channels]` |
| 604 | |
| 605 | Raises: |
| 606 | ValueError: if the shape of `image` not supported. |
| 607 | """ |
| 608 | with ops.name_scope(name, 'transpose', [image]): |
| 609 | image = ops.convert_to_tensor(image, name='image') |
| 610 | image = _AssertAtLeast3DImage(image) |
| 611 | shape = image.get_shape() |
| 612 | if shape.ndims == 3 or shape.ndims is None: |
| 613 | return array_ops.transpose(image, [1, 0, 2], name=name) |
| 614 | elif shape.ndims == 4: |
| 615 | return array_ops.transpose(image, [0, 2, 1, 3], name=name) |
| 616 | else: |
| 617 | raise ValueError('\'image\' must have either 3 or 4 dimensions.') |
| 618 | |
| 619 | |
| 620 | @tf_export('image.central_crop') |
nothing calls this directly
no test coverage detected