API reference¶
Visualization¶
General visualization utilities for transient rendering.
Warning
This module is accesible through mitransient.vis, NOT mitransient.unpolarized_visualization.
The functions are accessible through mitransient.vis when Mitsuba is NOT running with a *_polarized variant.
Else it uses the functions from mitransient.polarized_visualization.
- mitransient.unpolarized_visualization.save_frames(data, folder, axis_video=2)¶
Saves the transient image in separate frames (.exr format for each frame).
- mitransient.unpolarized_visualization.save_video(path, transient, axis_video=2, fps=24, display_video=False)¶
Saves the transient image in video format (.mp4).
- mitransient.unpolarized_visualization.show_video(input_sample, axis_video=2, uint8_srgb=True, normalize=False)¶
Shows the transient video in a IPython/Jupyter environment.
- Parameters:
input_sample – array representing the transient image
axis_video (int) – axis of the array for the temporal dimension
uint8_srgb (bool) – precision to use when converting to bitmap each frame of the video
- mitransient.unpolarized_visualization.tonemap_grad_transient(transient, axis_video=2)¶
Converts a gradient video to the coolwarm colormap.
- mitransient.unpolarized_visualization.tonemap_transient(transient, scaling=1.0)¶
Applies a linear tonemapping to the transient image.
Visualization (polarized variants)¶
Polarized version of “mitransient/unpolarized_visualization.py”
Warning
This module is accesible through mitransient.vis, NOT mitransient.polarized_visualization.
The functions are accessible through mitransient.vis when Mitsuba is running with a *_polarized variant.
Else it uses the functions from mitransient.unpolarized_visualization.
- class mitransient.polarized_visualization.DisplayMethod(value)¶
An enumeration.
- mitransient.polarized_visualization.degree_of_circular_polarization(stokes, s0_minimum=0.01)¶
Computes the degree of circular polarization of an array of Stokes vectors.
- Parameters:
stokes – Input array of Stokes vectors, with the Stokes components stored as the trailing axis of the array.
s0_minimum – Minimum value of the s0 component, to avoid NaNs caused by dividing by 0. Default value of 0.1.
- mitransient.polarized_visualization.degree_of_linear_polarization(stokes, s0_minimum=0.01)¶
Computes the degree of linear polarization of an array of Stokes vectors.
- Parameters:
stokes – Input array of Stokes vectors, with the Stokes components stored as the trailing axis of the array.
s0_minimum – Minimum value of the s0 component, to avoid NaNs caused by dividing by 0. Default value of 0.1.
- mitransient.polarized_visualization.degree_of_polarization(stokes, s0_minimum=0.01)¶
Computes the degree of polarization of an array of Stokes vectors.
- Parameters:
stokes – Input array of Stokes vectors, with the Stokes components stored as the trailing axis of the array.
s0_minimum – Minimum value of the s0 component, to avoid NaNs caused by dividing by 0. Default value of 0.1.
- mitransient.polarized_visualization.plot_to_numpy(fig)¶
Convert matplotlib figure into a rasterized image, stored as a numpy array.
- Parameters:
fig – Matplotlib figure to convert
- mitransient.polarized_visualization.polarization_generate_false_color(stokes, aolp_intensity_scaling=1.0, s0_minimum=0.01)¶
Given an input array of Stokes vectors, computes the false color visualizations of the degree of polarization, angle of polarization, type of polarization and chirality of circular polarization, following the format proposed in ‘A standardised polarisation visualisation for images’ [Wilkie and Weidlich, 2010].
- Parameters:
stokes – Input array of Stokes vectors, with the Stokes components stored as the trailing axis of the array.
aolp_intensity_scaling – Scale value for plotting the angle of linear polarization. Default value of 1.
s0_minimum – Minimum value of the s0 component, to avoid NaNs caused by dividing by 0. Default value of 0.1.
- mitransient.polarized_visualization.save_frames(data, axis_video, folder)¶
Saves the transient image in separate frames (.exr format for each frame).
- mitransient.polarized_visualization.save_video(path, transient, axis_video, fps=24, display_video=False)¶
Saves the transient image in video format (.mp4).
- mitransient.polarized_visualization.show_video(input_sample, axis_video, uint8_srgb=True)¶
Shows the transient video in a IPython/Jupyter environment.
- Parameters:
input_sample – array representing the transient image
axis_video (int) – axis of the array for the temporal dimension
uint8_srgb (bool) – precision to use when converting to bitmap each frame of the video
- mitransient.polarized_visualization.show_video_polarized(stokes, degree_of_polarization, angle_of_polarization, type_of_polarization, chirality, save_path=None, display_method=DisplayMethod.ShowVideo, fps=24, intensity_cutoff=0.9, gamma=1.1, show_false_color=True)¶
Displays or saves the transient-polarized video.
- Parameters:
stokes – transient stokes vector array
degree_of_polarization – false color degree of polarization
angle_of_polarization – false color angle or linear polarization
type_of_polarization – false color type of polarization
chirality – false color chirality of circular polarization
save_path – name of the folder where the transient frames will be saved / name of file of the transient video
display_method – ShowVideo shows the video in a Jupyter environment, SaveVideo saves it to a .mp4 file, SaveFrames saves it frame by frame
fps – framerate of the video to be displayed/saved
intensity_cutoff – intenisty quantile set as the maximum value during the tonemapping
gamma – gamma value for the tonemapping of the intensity component
show_false_color – if True shows the false color visualization, hidden otherwise
- mitransient.polarized_visualization.tonemap_transient(transient, scaling=1.0, normalize_M00=False)¶
Applies a linear tonemapping to the transient image.
Non-line-of-sight utils¶
- mitransient.nlos.focus_emitter_at_relay_wall_3dpoint(target, relay_wall, emitter)¶
Focuses the laser emitter in NLOS scenes towards target point in space. It requires to use the sensor
nlos_capture_meter.- Parameters:
target – 3d point in space at which laser will focus
relay_wall – reference to relay_wall object in the scene
emitter – reference to emitter object in the scene
- mitransient.nlos.focus_emitter_at_relay_wall_pixel(pixel, relay_wall, emitter)¶
Focuses the laser emitter in NLOS scenes towards the 3d point associated to the given pixel of
transient_hdr_film. It requires to use the sensornlos_capture_meter.- Parameters:
pixel – of the
transient_hdr_filmrelay_wall – reference to relay_wall object in the scene
emitter – reference to emitter object in the scene
- mitransient.nlos.focus_emitter_at_relay_wall_uv(uv, relay_wall, emitter)¶
Focuses the laser emitter in NLOS scenes towards the associated uv point of the relay wall. It requires to use the sensor
nlos_capture_meter.- Parameters:
uv – associated uv point of the relay wall
relay_wall – reference to relay_wall object in the scene
emitter – reference to emitter object in the scene
Utils¶
- mitransient.utils.cornell_box()¶
Returns a dictionary containing a description of the Cornell Box scene for Transient Rendering.
- mitransient.utils.set_thread_count(count)¶
Define the number of threads to be used
- mitransient.utils.speed_of_light = 299792458.0¶
Speed of light in meters/second