owl.color¶
- owl.color.bayer2rgb(image, bayer_pattern='rggb', output_array=None)[source]¶
Convert a raw image from a sensor with a Bayer filter to an RGB image.
- Parameters:
image (ArrayLike[N, M]) – The image to be converted.
N,Mshould be even.bayer_pattern – The bayer pattern of the sensor. Should be one of
['rggb', 'bggr', 'grbg', 'gbrg'].output_array (ArrayLike[N, M, 3] or None) – If OpenCV2 is installed, this specifies the output array of the operation. Without the OpenCV backend, this parameter can only take the value of None. If provided, this should be a C contiguous array.
- Returns:
output_array – The image converted to RGBA format.
- Return type:
ArrayLike[N, M, 3]
- owl.color.bayer2rgba(image, bayer_pattern: str = 'rggb', output_array=None)[source]¶
Convert a raw image from a sensor with a Bayer filter to an RGBA image.
- Parameters:
image (ArrayLike[N, M]) – The image to be converted.
N,Mshould be even.bayer_pattern – The bayer pattern of the sensor. Should be one of
['rggb', 'bggr', 'grbg', 'gbrg'].output_array (ArrayLike[N, M, 4] or None) – If OpenCV2 is installed, this specifies the output array of the operation. Without the OpenCV backend, this parameter can only take the value of None. If provided, this should be a C contiguous array.
- Returns:
output_array – The image converted to RGBA format.
- Return type:
ArrayLike[N, M, 4]
- owl.color.bayer2gray(image, bayer_pattern, output_array=None)[source]¶
Convert an image from a sensor with a Bayer filter to a grayscale image.
- Parameters:
image (ArrayLike[N, M]) – The image to be converted.
N,Mshould be even.bayer_pattern – The bayer pattern of the sensor. Should be one of
['rggb', 'bggr', 'grbg', 'gbrg'].output_array (ArrayLike[N, M] or None) – If OpenCV2 is installed, this specifies the output array of the operation. Without the OpenCV backend, this parameter can only take the value of None. If provided, this should be a C contiguous array.
- Returns:
output_array – The image converted to grayscale format.
- Return type:
ArrayLike[N, M]
- owl.color.rgb2gray(data, *, preserve_range=False, output_array=None, casting='same_kind', gray_vector=None)[source]¶
Convert ND images from rgb color space to grayscale color space.
Conversion from RGB color space to grayscale color space is done with the following coefficients:
[0.299, 0.587, 0.114]
- Parameters:
data (ndarray [..., 3]) – Multi-dimensional image where the last dimension has a dimension of 3. The color coordinates correspond to the red, green and blue channels respectively.
preserve_range –
If True, integer images will not be scaled between 0 and 1 prior to color space conversion. If False, integer images will be converted to floating point numbers between 0 and 1 following to scikit-image conventions.
Changed in version 0.14.0: In Version 0.14.0 the default value of preserved_range was changed to
False.output_array (ArrayLike[N, M] or None) – The output array of the operation. If provided, this should be a C contiguous array.
casting ({'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional)
gray_vector (array_like) – The coefficients to convert RGB to grayscale. By default, it is [0.299, 0.587, 0.114] but can be changed to another set of coefficients.
- owl.color.rgba2gray(data, *, preserve_range=False)[source]¶
Convert ND images from RGBA color space to grayscale color space.
Conversion from RGBA color space to grayscale color space is done with the following coefficients:
[0.299, 0.587, 0.114, 0]
- Parameters:
data (ndarray [..., 4]) – Multi-dimensional image where the last dimension has a dimension of 4. The color coordinates correspond to the red, green, blue and alpha channels respectively.
preserve_range –
If True, integer images will not be scaled between 0 and 1 prior to color space conversion. If False, integer images will be converted to floating point numbers between 0 and 1 following to scikit-image conventions.
Changed in version 0.14.0: In Version 0.14.0 the default value of preserved_range was changed to
False.
- owl.color.get_converted_dataset(dataset, conversion_matrix)[source]¶
Apply photometric response to the dataset images variable
- Parameters:
dataset (xarray Dataset) – MCAM data containing image data as well as additional metadata. Image data should be RGB.
conversion_matrix (numpy Array) – NxMx3x3 Matrix to be applied to the image data. NxM should match the shape image_y and image_x dimension of the dataset.
- Returns:
converted_dataset
- Return type:
xarray Dataset