code wiki / (root) / nx_image.nx

nx_image.nx

buildroot/runtime/nx_image.nx

11970 B359 linesdepth 4pulls 5 transitivereach 160 importersview sourcekind librarytopic image
docsdependenciesstructsconstsfunctions

about

nx_image.nx -- pure-math image primitives. No model files, no learned weights, no VLM. Classical computer vision math: pixel access, grayscale conversion, 3x3 convolution, Sobel gradient, gradient magnitude via integer sqrt, histogram. All i64. Uses nx_i128 muldiv where intermediate products risk overflow (per NUMERIC_TIER_LADDER + S_CLASS_MATH_DOCTRINE). genealogy_id: gonzalez_woods_digital_image_processing + canny_1986 + sobel_feldman_1968 lineage_id: convolution + gradient + integer_pixel_arithmetic axioms: NX_AX_ALG_DISTRIBUTIVITY, NX_AX_ALG_COMMUTATIVITY nx_safety_envelope: intended_use: "Image container + convolution/gradient/ integer-pixel ops. Foundation for all substrate visual processing." sil_target: SIL2 (visual integrity in safety-relevant UI -- e.g. medical imaging, aviation HUDs) asil_target: QM dal_target: DAL C evidence: [Image_canonical_container_type, bounded_pixel_loops, axiom_distributivity_commutativity_tagged] hazard_register: [bug-tape-image-stride-not-validated, bug-tape-OOB-pixel-read-via-bad-coord, bug-tape-channel-count-mismatch-corruption] residual_risk: "Image stride + dimensions are caller- supplied. Substrate validates bounds at function entry; loop bodies trust them. Image format compatibility (RGB vs RGBA vs YUV) is upstream responsibility." verdict: NOT_YET_EVALUATED

dependencies 3 imports · 128 importers

nx_syscalls.nx nx_axioms.nx nx_i128.nx nx_image.nx nx_aesthetics.nx nx_aesthetics_test.nx nx_anatomy_measure.nx nx_anatomy_measure_test.nx nx_areola_localize.nx nx_areola_localize_test.nx nx_areola_pigment.nx nx_areola_pigment_test.nx nx_areola_texture.nx nx_areola_texture_test.nx

diagram shows first 10 each side; +0 more imports, +118 more importers in the complete lists below.

imports: nx_syscalls.nxnx_axioms.nxnx_i128.nx

imported by: nx_aesthetics.nxnx_aesthetics_test.nxnx_anatomy_measure.nxnx_anatomy_measure_test.nxnx_areola_localize.nxnx_areola_localize_test.nxnx_areola_pigment.nxnx_areola_pigment_test.nxnx_areola_texture.nxnx_areola_texture_test.nxnx_arm_count.nxnx_arm_count_test.nxnx_arousal_detail_test.nxnx_award_axes_test.nxnx_blob.nxnx_blob_gate.nxnx_bmp.nxnx_bmp_tiff_gate.nxnx_body_flush.nxnx_body_measurement_extract.nxnx_body_measurement_extract_test.nxnx_breast_localize.nxnx_cam.nxnx_cam_test.nxnx_clarity_test.nxnx_color_palette.nxnx_color_v2.nxnx_color_v2_test.nxnx_compose.nxnx_compose_test.nxnx_cube3d_gate.nxnx_cube3d_lit_gate.nxnx_cube3d_spin_gate.nxnx_deadair.nxnx_deadair_gate.nxnx_depth_tri.nxnx_depth_tri_gate.nxnx_editjudge_lib.nxnx_eye_detect.nxnx_eye_detect_test.nxnx_face_count.nxnx_face_count_test.nxnx_face_probe.nxnx_features.nxnx_features_test.nxnx_garment_extract_measurements.nxnx_garment_extract_measurements_test.nxnx_geom.nxnx_geom_test.nxnx_haar.nxnx_haar_cascade.nxnx_haar_cascade_gate.nxnx_haar_gate.nxnx_image_clarity.nxnx_image_feature_extract.nxnx_image_feature_extract_test.nxnx_image_load_raw.nxnx_image_load_raw_test.nxnx_integral.nxnx_integral_gate.nxnx_lash_transition.nxnx_lash_transition_test.nxnx_light.nxnx_light_test.nxnx_lighting_consistency.nxnx_localizers_test.nxnx_lower_anatomy_test.nxnx_mannequin_index_test.nxnx_media_index.nxnx_media_run.nxnx_media_run_gate.nxnx_mise_en_scene.nxnx_mise_en_scene_test.nxnx_motion.nxnx_motion_test.nxnx_ms_ssim.nxnx_multi_body.nxnx_multi_body_test.nxnx_ng_gsview.nxnx_ng_world.nxnx_oscar_batch_test.nxnx_outfit_coverage.nxnx_outfit_coverage_test.nxnx_ppm.nxnx_presence.nxnx_presence_gate.nxnx_pressure_deformation.nxnx_pressure_deformation_test.nxnx_quality_driver.nxnx_raster_legacy.nxnx_refbench_lib.nxnx_region.nxnx_region_isolated_test.nxnx_region_test.nxnx_render_pass.nxnx_response_signal.nxnx_response_signal_test.nxnx_salience.nxnx_salience_test.nxnx_scale.nx +28 more (shown cap 100 declared)

structs

46struct Image {
70struct ImageS64 {

consts

54const NX_IMG_BYTES: i64 = 40
76const NX_IMGS64_BYTES: i64 = 24

functions

56func nx_image_alloc(width: i64, height: i64, channels: i64) -> *Image {
called by 86: mainmainmainmainmainmain+80 calls 1: sys_mmap
78func nx_image_s64_alloc(width: i64, height: i64) -> *ImageS64 {
89func nx_image_get(img: *Image, x: i64, y: i64, c: i64) -> i64 {
97func nx_image_set(img: *Image, x: i64, y: i64, c: i64, v: i64) -> i64 {
111func nx_image_s64_get(img: *ImageS64, x: i64, y: i64) -> i64 {
119func nx_image_s64_set(img: *ImageS64, x: i64, y: i64, v: i64) -> i64 {
133func nx_image_to_grayscale(rgb: *Image) -> *Image {
157func nx_image_convolve_3x3(src: *Image, kernel: *i64, channel: i64) -> *ImageS64 {
189func nx_image_sobel_x(gray: *Image) -> *ImageS64 {
197func nx_image_sobel_y(gray: *Image) -> *ImageS64 {
207func nx_image_gradient_magnitude(gx: *ImageS64, gy: *ImageS64) -> *ImageS64 {
240func nx_image_histogram_256(img: *Image, channel: i64, out_bins: *i64) -> i64 {
267func nx_image_otsu_threshold(img: *Image, channel: i64) -> i64 {
309func nx_image_threshold(img: *Image, channel: i64, thresh: i64) -> *Image {
331func nx_image_s64_to_u8(src: *ImageS64) -> *Image {