From 64e754bc069247ec4ab30236aeb0a3b10f50c984 Mon Sep 17 00:00:00 2001 From: diegoroyo Date: Mon, 12 Dec 2022 10:43:15 +0100 Subject: [PATCH] fix: confocal/exhaustive modes updated to match mitsuba2-transient-nlos --- tal/__init__.py | 2 +- tal/render/mitsuba2_transient_nlos.py | 12 ++++++------ tal/render/render.py | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tal/__init__.py b/tal/__init__.py index 5b36555..ff6cf6d 100644 --- a/tal/__init__.py +++ b/tal/__init__.py @@ -2,4 +2,4 @@ from tal.plot import * from tal.reconstruct import * -__version__ = '0.7.0' +__version__ = '0.7.1' diff --git a/tal/render/mitsuba2_transient_nlos.py b/tal/render/mitsuba2_transient_nlos.py index 0323db4..a03c53c 100644 --- a/tal/render/mitsuba2_transient_nlos.py +++ b/tal/render/mitsuba2_transient_nlos.py @@ -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. @@ -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')) @@ -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) diff --git a/tal/render/render.py b/tal/render/render.py index 0c4bb99..7686e93 100644 --- a/tal/render/render.py +++ b/tal/render/render.py @@ -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}')