e06eee5deec11dc03d6c4975eb9a57f2bc6edd30,kornia/utils/image.py,,image_to_tensor,#Any#,7
Before Change
tensor: torch.Tensor = torch.from_numpy(image)
if len(tensor.shape) == 2:
tensor = torch.unsqueeze(tensor, dim=-1)
return tensor.permute(2, 0, 1).squeeze_() // CxHxW
def tensor_to_image(tensor: torch.Tensor) -> np.array:
After Change
"Input size must be a two, three or four dimensional array")
input_shape = image.shape
if len(input_shape) == 2:
tensor: torch.Tensor = hw_image_to_hw_tensor(image)
elif len(input_shape) == 3:
tensor: torch.Tensor = hwc_image_to_chw_tensor(image)
elif len(input_shape) == 4:
tensor: torch.Tensor = bhwc_image_to_bchw_tensor(image)
else:
raise ValueError("Cannot process image with shape {}".format(input_shape))
return tensor
def hw_tensor_to_hw_image(tensor: torch.Tensor) -> np.array:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: arraiy/torchgeometry
Commit Name: e06eee5deec11dc03d6c4975eb9a57f2bc6edd30
Time: 2019-05-28
Author: jiangwei1993@gmail.com
File Name: kornia/utils/image.py
Class Name:
Method Name: image_to_tensor
Project Name: arraiy/torchgeometry
Commit Name: 4778abaca41a86139ea720817c7091fbfe6be374
Time: 2019-01-07
Author: edgar.riba@gmail.com
File Name: torchgeometry/pinhole.py
Class Name:
Method Name: inverse_pose
Project Name: arraiy/torchgeometry
Commit Name: e0e673fa73d2e71ec1c71d60deb6ff9151f387fd
Time: 2019-01-21
Author: edgar.riba@gmail.com
File Name: torchgeometry/conversions.py
Class Name:
Method Name: quaternion_to_angle_axis