eradiate.xarray.interp.dataarray_to_rgb#
- eradiate.xarray.interp.dataarray_to_rgb(da, channels, normalize=True, gamma_correction=True)[source]#
Compose an RGB image from radiance data.
- Parameters:
da (
DataArray
) – The data array from which radiance data will be taken. It has to be such that data, when selected on a spectral axis, is 2-dimensional.channels (sequence of
tuples
) – Three (coordinate label, coordinate value) pairs used to select the data used to compose the image. Channels are ordered as follows: (R, G, B). For instance, to select wavelengths (dimension"w"
) at 440 (blue), 550 (green) and 660 (red) nm, usechannels=[("w", 660), ("w", 550), ("w", 440)]
.normalize (
bool
, optional) – IfTrue
, the data will be normalized by its maximum value.gamma_correction (
bool
, optional) – IfTrue
, apply a gamma operator to the data.
- Returns:
ndarray
– An RGB image which can be displayed usingmatplotlib.pyplot.imshow()
.
Warning
The image processing pipeline implemented by this function is rudimentary. It only applies, if instructed, a gamma operator. For more advanced tone mapping operations, use this function with
normalize=False
andgamma_correction=False
, then apply your own post-processing to the resulting (N, M, 3)-shaped array.