MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / rgb2bgr

Function rgb2bgr

detrsmpl/core/renderer/torch3d_renderer/utils.py:63–70  ·  view source on GitHub ↗

Convert color channels.

(rgbs)

Source from the content-addressed store, hash-verified

61
62
63def rgb2bgr(rgbs) -> Union[torch.Tensor, np.ndarray]:
64 """Convert color channels."""
65 bgrs = [rgbs[..., 2, None], rgbs[..., 1, None], rgbs[..., 0, None]]
66 if isinstance(rgbs, torch.Tensor):
67 bgrs = torch.cat(bgrs, -1)
68 elif isinstance(rgbs, np.ndarray):
69 bgrs = np.concatenate(bgrs, -1)
70 return bgrs
71
72
73def align_input_to_padded(tensor=Union[List[torch.Tensor], torch.Tensor],

Callers 3

wrap_textureMethod · 0.85
_write_imagesMethod · 0.85
forwardMethod · 0.85

Calls 1

concatenateMethod · 0.80

Tested by

no test coverage detected