nx_lighting_consistency.nx
buildroot/runtime/nx_lighting_consistency.nx
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
imports: nx_syscalls.nxnx_image.nx
imported by: nx_award_axes_test.nx
structs
| none |
consts
| 35 | const NX_MAGIC_1024: i64 = 1024 |
| 36 | const NX_MAGIC_2048: i64 = 2048 |
| 38 | const NX_LIT_RES_SUBJ_RB: i64 = 0 |
| 39 | const NX_LIT_RES_ENV_RB: i64 = 1 |
| 40 | const NX_LIT_RES_TEMP_MATCH: i64 = 2 |
| 41 | const NX_LIT_RES_SUBJ_Y: i64 = 3 |
| 42 | const NX_LIT_RES_ENV_Y: i64 = 4 |
| 43 | const NX_LIT_RES_DIR_MATCH: i64 = 5 |
| 44 | const NX_LIT_RES_COMPOSITE: i64 = 6 |
| 45 | const NX_LIT_RES_VERDICT: i64 = 7 |
| 46 | const NX_LIT_RES_FIELDS: i64 = 8 |
| 48 | const NX_LIT_V_COMPOSITING_SEAM: i64 = 0 |
| 49 | const NX_LIT_V_INCONSISTENT: i64 = 1 |
| 50 | const NX_LIT_V_ACCEPTABLE: i64 = 2 |
| 51 | const NX_LIT_V_COHERENT: i64 = 3 |
functions
| 55 | func nx_lit_mean_temp_and_y(rgb: *Image, mask: *Image, |
| 105 | func nx_lit_direction_y(rgb: *Image, x0: i64, y0: i64, x1: i64, y1: i64) -> i64 |
| 119 | func nx_lighting_consistency(rgb: *Image, skin_mask: *Image, |