code wiki / (root) / nx_lighting_consistency.nx

nx_lighting_consistency.nx

buildroot/runtime/nx_lighting_consistency.nx

6736 B171 linesdepth 5pulls 6 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_lighting_consistency.nx -- subject lighting vs environment lighting match. Image #58 failure: subject (woman) appears lit by warm interior light but the environment (rainy window behind) is cool daylight. Body reads as "pasted in" — a compositing seam. Real cinematography keeps subject + environment under the SAME light temperature + direction. Math: Compute color temperature proxy for subject (skin region) and environment (background region) via R:B ratio and mean luminance. Compute light direction proxy via brightness gradient across each. Score the MATCH between the two readings. Inputs: rgb image + skin_mask + environment bbox (background region). Output flat-array: result[0] = subject_R_to_B_q10 warm/cool proxy result[1] = env_R_to_B_q10 result[2] = temp_match_q10 1024 = perfect match result[3] = subject_brightness mean Y in skin result[4] = env_brightness result[5] = direction_match_q10 1024 = same light direction result[6] = composite_q10 result[7] = verdict 0=COMPOSITING_SEAM / 1=INCONSISTENT / 2=ACCEPTABLE / 3=COHERENT

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_image.nx nx_lighting_consistency.nx nx_award_axes_test.nx

imports: nx_syscalls.nxnx_image.nx

imported by: nx_award_axes_test.nx

structs

none

consts

35const NX_MAGIC_1024: i64 = 1024
36const NX_MAGIC_2048: i64 = 2048
38const NX_LIT_RES_SUBJ_RB: i64 = 0
39const NX_LIT_RES_ENV_RB: i64 = 1
40const NX_LIT_RES_TEMP_MATCH: i64 = 2
41const NX_LIT_RES_SUBJ_Y: i64 = 3
42const NX_LIT_RES_ENV_Y: i64 = 4
43const NX_LIT_RES_DIR_MATCH: i64 = 5
44const NX_LIT_RES_COMPOSITE: i64 = 6
45const NX_LIT_RES_VERDICT: i64 = 7
46const NX_LIT_RES_FIELDS: i64 = 8
48const NX_LIT_V_COMPOSITING_SEAM: i64 = 0
49const NX_LIT_V_INCONSISTENT: i64 = 1
50const NX_LIT_V_ACCEPTABLE: i64 = 2
51const NX_LIT_V_COHERENT: i64 = 3

functions

55func nx_lit_mean_temp_and_y(rgb: *Image, mask: *Image,
105func nx_lit_direction_y(rgb: *Image, x0: i64, y0: i64, x1: i64, y1: i64) -> i64
119func nx_lighting_consistency(rgb: *Image, skin_mask: *Image,