data_handlers.formatters
Author: Ismael Seidel (ismael.seidel@ufsc.br) Affiliation: Embedded Computing Lab (ECL), Federal University of Santa Catarina (UFSC)
- Description:
This module contains helpers to deal with filenames for light fields.
- get_modified_date(filename)[source]
Gets the last modified date of a file.
- Parameters:
filename (Union[str, Path]) – Path to the file
- Returns:
Last modified date as a string
- Return type:
str
- get_bpp_str(bpp)[source]
Formats the bits per pixel (bpp) value into a string.
- Parameters:
bpp (float) – Bits per pixel value
- Returns:
Formatted bpp string
- Return type:
str
- get_formatted_filename(path, pix_fmt, lf_name, view_width, view_height, n_views_width, n_views_height, file_extension='yuv', bpp=None, extra='', extra_end='')[source]
Generates a formatted filename for a Light Field file.
- Parameters:
path (Union[str, Path, None]) – Path to the directory
pix_fmt (str) – Pixel format
lf_name (str) – Name of the Light Field
view_width (int) – Width of a single view
view_height (int) – Height of a single view
n_views_width (int) – Number of views in width
n_views_height (int) – Number of views in height
file_extension (str, optional) – File extension, defaults to “yuv”
bpp (Optional[float], optional) – Bits per pixel, defaults to None
extra (str, optional) – Extra string to append, defaults to “”
extra_end (str, optional) – Extra string to append at the end, defaults to “”
- Returns:
Formatted filename
- Return type:
str
- get_formatted_pgx_or_ppm_path(path, lightfield, bpp=None)[source]
Gets the formatted path for PGX or PPM light field files.
- Parameters:
path (Optional[Union[str, Path]]) – Path to the directory, or None
lightfield (LightField) – Light Field data
bpp (Optional[float], optional) – Bits per pixel, defaults to None
- Returns:
Path to the formatted filename
- Return type:
Path
- get_formatted_filename_for_lf(path, lightfield, bpp=None, file_extension='yuv', extra='', extra_end='')[source]
Generates a formatted filename for a Light Field file.
- Parameters:
path (Union[str, Path, None]) – Path to the directory
lightfield (RAWLightFieldData) – Light Field data
bpp (Optional[float], optional) – Bits per pixel, defaults to None
file_extension (str, optional) – File extension, defaults to “yuv”
extra (str, optional) – Extra string to append, defaults to “”
extra_end (str, optional) – Extra string to append at the end, defaults to “”
- Returns:
Formatted filename
- Return type:
Path
- get_yuv_filename(yuv_path, pix_fmt, lf_name, view_width, view_height, n_views_width, n_views_height)[source]
Generates a formatted filename for a Light Field file.
- Parameters:
yuv_path (Union[str, Path]) – Path to the directory
pix_fmt (str) – Pixel format
lf_name (str) – Name of the Light Field
view_width (int) – Width of a single view
view_height (int) – Height of a single view
n_views_width (int) – Number of views in width
n_views_height (int) – Number of views in height
- Returns:
Formatted filename
- Return type:
str
- get_yuv_filename_for_lf(yuv_path, pix_fmt, lightfield)[source]
Generates a formatted filename for a Light Field file.
- Parameters:
yuv_path (Union[str, Path]) – Path to the directory
pix_fmt (str) – Pixel format
lightfield (LightField) – Light Field data
- Returns:
Formatted filename
- Return type:
str
- get_view_name_with_leading_zeros(x, y)[source]
Generates a view name with leading zeros based on coordinates.
- Parameters:
x (int) – Horizontal coordinate
y (int) – Vertical coordinate
- Returns:
Formatted view name
- Return type:
str