|
from ips.ops import * |
|
|
|
|
|
def process(raw_image, metadata): |
|
out = normalize(raw_image, metadata["black_level"], metadata["white_level"]) |
|
out = demosaic(out, metadata["cfa_pattern"]) |
|
out = raw_color_denoise(out, metadata["noise_profile"][1]) |
|
out = white_balance(out, metadata) |
|
color_matrix = [ |
|
1.06835938, -0.29882812, -0.14257812, |
|
-0.43164062, 1.35546875, 0.05078125, |
|
-0.1015625, 0.24414062, 0.5859375 |
|
] |
|
out = xyz_transform(out, color_matrix) |
|
out = xyz_to_srgb(out) |
|
out = luminance_denoise(out, metadata["tv_weight"]) |
|
out = perform_tone_mapping(out, metadata) |
|
out = global_mean_contrast(out, metadata["global_mc_beta"]) |
|
out = s_curve_correction(out, metadata["scc_alpha"], metadata["scc_lambda"]) |
|
out = histogram_stretching(out) |
|
out = memory_color_enhancement(out) |
|
out = unsharp_masking(out) |
|
out = to_uint8(out) |
|
out = resize(out, metadata["exp_width"], metadata["exp_height"]) |
|
out = fix_orientation(out, metadata["orientation"]) |
|
|
|
return out |
|
|