mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-01 13:28:59 +08:00
Make background_color a required argument in blend_background
This commit is contained in:
1 parent
e24f15baad
commit
c15fa1819d
1 file changed
+2
-4
@@ -133,7 +133,7 @@ class RGBRenderer(nn.Module):
|
|||||||
cls,
|
cls,
|
||||||
rgb: Tensor,
|
rgb: Tensor,
|
||||||
opacity: Tensor,
|
opacity: Tensor,
|
||||||
background_color: Optional[Tensor] = None,
|
background_color: Tensor,
|
||||||
) -> Float[Tensor, "*bs 3"]:
|
) -> Float[Tensor, "*bs 3"]:
|
||||||
"""Blends the background color into the image.
|
"""Blends the background color into the image.
|
||||||
|
|
||||||
@@ -147,9 +147,7 @@ class RGBRenderer(nn.Module):
|
|||||||
"""
|
"""
|
||||||
if len(opacity.shape) == 1:
|
if len(opacity.shape) == 1:
|
||||||
opacity = opacity.unsqueeze(-1)
|
opacity = opacity.unsqueeze(-1)
|
||||||
blended_rgb = (
|
blended_rgb = rgb * opacity + background_color.to(rgb.device) * (1 - opacity)
|
||||||
rgb * opacity + background_color.to(rgb.device) * (1 - opacity) if background_color is not None else rgb
|
|
||||||
)
|
|
||||||
return blended_rgb
|
return blended_rgb
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
|
|||||||
Reference in new issue
Block a user