Skip to content

Commit

Permalink
fix: confocal/exhaustive modes updated to match mitsuba2-transient-nlos
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoroyo committed Dec 12, 2022
1 parent bcffe80 commit 64e754b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from tal.plot import *
from tal.reconstruct import *

__version__ = '0.7.0'
__version__ = '0.7.1'
12 changes: 6 additions & 6 deletions tal/render/mitsuba2_transient_nlos.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def read_mitsuba_bitmap(path: str):
return np.array(Bitmap(path), copy=False)


def read_mitsuba_streakbitmap(path: str, exr_format='RGBA'):
def read_mitsuba_streakbitmap(path: str, exr_format='RGB'):
"""
Reads all the images x-t that compose the streak image.
Expand All @@ -183,11 +183,11 @@ def read_mitsuba_streakbitmap(path: str, exr_format='RGBA'):
from tqdm import tqdm

# FIXME(diego): for now this assumes that the EXR that it reads
# are in RGBA format, and returns an image with 3 channels,
# are in RGB format, and returns an image with 3 channels,
# in the case of polarized light it should return something else
if exr_format != 'RGBA':
if exr_format != 'RGB':
raise NotImplementedError(
'Formats different from RGBA are not implemented')
'Formats different from RGB are not implemented')

xtframes = glob.glob(os.path.join(
glob.escape(path), f'frame_*.exr'))
Expand All @@ -204,7 +204,7 @@ def read_mitsuba_streakbitmap(path: str, exr_format='RGBA'):
pbar.update(1)

# for now streak_img has dimensions (y, x, time, channels)
assert streak_img.shape[-1] == 4, \
f'Careful, streak_img has shape {streak_img.shape} (i.e. its probably not RGBA as we assume)'
assert streak_img.shape[-1] == 3, \
f'Careful, streak_img has shape {streak_img.shape} (i.e. its probably not RGB as we assume, last dimension should be 3)'
# and we want it as (time, x, y)
return np.sum(np.transpose(streak_img), axis=0)
5 changes: 3 additions & 2 deletions tal/render/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,9 @@ def partial_laser_dir(lx, ly):

for x in range(laser_width):
for y in range(laser_height):
capture_data.H[:, x, y, ...] = read_mitsuba_streakbitmap(
partial_laser_dir(x + 0.5, y + 0.5))
capture_data.H[:, x, y, ...] = np.squeeze(
read_mitsuba_streakbitmap(
partial_laser_dir(x + 0.5, y + 0.5)))
else:
raise AssertionError(
'Invalid scan_type, must be one of {single|exhaustive|confocal}')
Expand Down

0 comments on commit 64e754b

Please sign in to comment.