Utils
utils
Additional utility functions.
Functions:
-
add_metadata–Adds metadata to an image file.
-
find_data–Search for camera and lens name in metadata
-
generate_histogram–Generate an RGB histogram using a precomputed uint8 blending lookup table.
-
load_metadata–Loads and caches image exit data.
-
precompute_mix_table–Precomputes a (2, 2, 2, 4) sRGB lookup table using linear blending.
Attributes:
-
MIX_TABLE–Lookup table for the histogram colors.
MIX_TABLE
module-attribute
MIX_TABLE = precompute_mix_table()
Lookup table for the histogram colors.
add_metadata
add_metadata(et, src, metadata, exp_comp)
Adds metadata to an image file.
find_data
find_data(metadata, db)
Search for camera and lens name in metadata
generate_histogram
generate_histogram(image, mix_table=MIX_TABLE, height=100)
Generate an RGB histogram using a precomputed uint8 blending lookup table.
Parameters
image : np.ndarray Input RGB image (H x W x 3), dtype uint8. mix_table : np.ndarray Precomputed lookup matrix of shape (2, 2, 2, 4), dtype uint8. height : int Height of the histogram image.
load_metadata
cached
load_metadata(src)
Loads and caches image exit data.
precompute_mix_table
precompute_mix_table(red=None, green=None, blue=None)
Precomputes a (2, 2, 2, 4) sRGB lookup table using linear blending.
Indices match: mix_table[red_active, green_active, blue_active] Output channel 0-2: RGB, Channel 3: Alpha (0 or 255)