data_handlers.lightfield

Author: Ismael Seidel (ismael.seidel@ufsc.br) Affiliation: Embedded Computing Lab (ECL), Federal University of Santa Catarina (UFSC)

Description:

This module contains the base classes for representing light fields and dealing with filenames.

class LightField(name, view_width, view_height, n_views_width, n_views_height)[source]

Bases: object

Parameters:
  • name (str)

  • view_width (int)

  • view_height (int)

  • n_views_width (int)

  • n_views_height (int)

get_number_of_pixels()[source]

Calculates the total number of pixels in the Light Field.

Returns:

Total number of pixels

Return type:

int

get_number_of_pixels_per_view()[source]

Calculates the number of pixels in a single view of the Light Field.

Returns:

Number of pixels per view

Return type:

int

get_number_of_views()[source]

Calculates the total number of views in the Light Field.

Returns:

Total number of views

Return type:

int

copy()[source]

Creates a copy of the Light Field instance.

Returns:

A new LightField instance with the same properties

Return type:

LightField

get_md5()[source]

Raises an error as MD5 calculation is undefined for this class.

Raises:

NotImplementedError – Behavior undefined for this class

Returns:

Never returns

Return type:

str

class RAWLightFieldData(lightfield, raw_path, bits_per_sample=10, type=None, pix_fmt='yuv444p10le', colour_space='BT.709 Full Range', initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Bases: LightField

Parameters:
  • lightfield (LightField)

  • raw_path (str | Path)

  • bits_per_sample (int)

  • type (str | None)

  • pix_fmt (str)

  • colour_space (str)

  • initial_width (int)

  • initial_height (int)

  • step_width (int)

  • step_height (int)

  • bpp_for_naming (Any | None)

  • scan_order (Callable[[int, int, int, int, int, int], List[Tuple[int, int]] | List[int]])

  • remove_after_using (bool)

__init__(lightfield, raw_path, bits_per_sample=10, type=None, pix_fmt='yuv444p10le', colour_space='BT.709 Full Range', initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Initializes a RAWLightFieldData instance with the given parameters.

Parameters:
  • lightfield (LightField) – Base LightField instance

  • raw_path (Union[str, Path]) – Path to the raw data

  • bits_per_sample (int, optional) – Number of bits per sample, defaults to 10

  • type (str, optional) – Type of the raw data, defaults to None

  • pix_fmt (str, optional) – Pixel format, defaults to “yuv444p10le”

  • colour_space (str, optional) – Colour space, defaults to “BT.709 Full Range”

  • initial_width (int, optional) – Initial width of the Light Field, defaults to 0

  • initial_height (int, optional) – Initial height of the Light Field, defaults to 0

  • step_width (int, optional) – Step width for processing, defaults to 1

  • step_height (int, optional) – Step height for processing, defaults to 1

  • bpp_for_naming (optional) – Bits per pixel for naming purposes, defaults to None

  • scan_order (ScanFunctionType, optional) – Scan order function, defaults to get_serpentine_scan_list

  • remove_after_using (bool, optional) – Whether to remove data after use, defaults to False

class RAW_RGB_PPM_LightField_Data(lightfield, ppm_path, initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Bases: RAWLightFieldData

Parameters:
  • lightfield (LightField)

  • ppm_path (str | Path)

  • initial_width (int)

  • initial_height (int)

  • step_width (int)

  • step_height (int)

  • bpp_for_naming (Any | None)

  • scan_order (Callable[[int, int, int, int, int, int], List[Tuple[int, int]] | List[int]])

  • remove_after_using (bool)

get_md5()[source]

Computes MD5 hash of the PPM light field data.

Returns:

MD5 hash string, or None if raw_path is undefined

Return type:

Optional[str]

class RAW_RGB_PNG_LightField_Data(lightfield, png_path, bits_per_sample=8, initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Bases: RAWLightFieldData

Parameters:
  • lightfield (LightField)

  • png_path (str | Path)

  • bits_per_sample (int)

  • initial_width (int)

  • initial_height (int)

  • step_width (int)

  • step_height (int)

  • bpp_for_naming (Any | None)

  • scan_order (Callable[[int, int, int, int, int, int], List[Tuple[int, int]] | List[int]])

  • remove_after_using (bool)

get_md5()[source]

Computes MD5 hash of the PNG light field data.

Returns:

MD5 hash string, or None if raw_path is undefined

Return type:

Optional[str]

class RAW_BT709_FR_PGX_LightField_Data(lightfield, pgx_path, initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Bases: RAWLightFieldData

Parameters:
  • lightfield (LightField)

  • pgx_path (str | Path)

  • initial_width (int)

  • initial_height (int)

  • step_width (int)

  • step_height (int)

  • bpp_for_naming (Any | None)

  • scan_order (Callable[[int, int, int, int, int, int], List[Tuple[int, int]] | List[int]])

  • remove_after_using (bool)

get_md5()[source]

Computes MD5 hash of the PGX light field data.

Returns:

MD5 hash string, or None if raw_path is undefined

Return type:

Optional[str]

class RAW_BT709_FR_YUV444p10le_LightField_Data(lightfield, yuv_path, initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Bases: RAWLightFieldData

Parameters:
  • lightfield (LightField)

  • yuv_path (str | Path | None)

  • initial_width (int)

  • initial_height (int)

  • step_width (int)

  • step_height (int)

  • bpp_for_naming (Any | None)

  • scan_order (Callable[[int, int, int, int, int, int], List[Tuple[int, int]] | List[int]])

  • remove_after_using (bool)

get_md5()[source]

Computes MD5 hash of the YUV light field file.

Returns:

MD5 hash string, or None if raw_path is undefined

Return type:

Optional[str]

class RAW_Decoded_BT709_FR_YUV444p10le_LightField_Data(lightfield, decoded_filename, initial_width=0, initial_height=0, step_width=1, step_height=1, bpp_for_naming=None, scan_order=<function get_serpentine_scan_list>, remove_after_using=False)[source]

Bases: RAWLightFieldData

Parameters:
  • lightfield (LightField)

  • decoded_filename (str | Path)

  • initial_width (int)

  • initial_height (int)

  • step_width (int)

  • step_height (int)

  • bpp_for_naming (Any | None)

  • scan_order (Callable[[int, int, int, int, int, int], List[Tuple[int, int]] | List[int]])

  • remove_after_using (bool)

get_md5()[source]

Computes MD5 hash of the decoded YUV light field file.

Returns:

MD5 hash string, or None if raw_path is undefined

Return type:

Optional[str]

class EncodedLightField(lightfield, encoded_path, target_bitrate, actual_bitrate, encoder_name, pix_fmt='yuv444p10le', colour_space='BT.709 Full Range')[source]

Bases: LightField

Parameters:
  • lightfield (LightField)

  • encoded_path (str | Path)

  • target_bitrate (float)

  • actual_bitrate (float)

  • encoder_name (str)

  • pix_fmt (str)

  • colour_space (str)

get_md5()[source]

Computes MD5 hash of the encoded light field file.

Returns:

MD5 hash string, or None if encoded_path is undefined

Return type:

Optional[str]