mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-25 18:39:55 +08:00
Add boolean visualization (#225)
This commit is contained in:
1 parent
87df978582
commit
395b03f48c
4 files changed
+80
-19
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
Test visualizations
|
||||
"""
|
||||
import torch
|
||||
|
||||
from nerfactory.utils import visualization
|
||||
|
||||
|
||||
def test_apply_colormap():
|
||||
"""Test adding a colormap to data"""
|
||||
data = torch.rand((10, 20, 1))
|
||||
colored_data = visualization.apply_colormap(data)
|
||||
|
||||
assert colored_data.shape == (10, 20, 3)
|
||||
assert torch.min(colored_data) >= 0
|
||||
assert torch.max(colored_data) <= 1
|
||||
|
||||
|
||||
def test_apply_depth_colormap():
|
||||
"""Test adding a colormap to depth data"""
|
||||
data = torch.rand((10, 20, 1))
|
||||
accum = torch.rand((10, 20, 1))
|
||||
accum = accum / torch.max(accum)
|
||||
colored_data = visualization.apply_depth_colormap(depth=data, accumulation=accum)
|
||||
|
||||
assert colored_data.shape == (10, 20, 3)
|
||||
assert torch.min(colored_data) >= 0
|
||||
assert torch.max(colored_data) <= 1
|
||||
|
||||
|
||||
def test_apply_boolean_colormap():
|
||||
"""Test adding a colormap to boolean data"""
|
||||
data = torch.rand((10, 20, 1))
|
||||
data = data > 0.5
|
||||
colored_data = visualization.apply_boolean_colormap(data)
|
||||
|
||||
assert colored_data.shape == (10, 20, 3)
|
||||
assert torch.min(colored_data) >= 0
|
||||
assert torch.max(colored_data) <= 1
|
||||
Reference in new issue
Block a user