code wiki / (root) / nx_self_similarity.nx

nx_self_similarity.nx

buildroot/runtime/nx_self_similarity.nx

8762 B253 linesdepth 5pulls 6 transitivereach 7 importersview sourcekind librarytopic self
docsdependenciesstructsconstsfunctions

about

nx_self_similarity.nx -- box-counting fractal dimension primitive. Cross-modal aesthetic kernel. Box-counting estimates the fractal dimension D of an edge-image; for natural images D is empirically in [1.0, 2.0] where: D = 1.0 pure line (low fractal complexity) D ~ 1.4 Spehar-2003 peak aesthetic preference D = 2.0 filled plane (maximally complex) Mandelbrot 1967, Falconer "Fractal Geometry" 1990, Spehar et al. 2003 "Universal aesthetic of fractals." Generalizes from images to any 2D signal: spectrograms, attention heatmaps, terrain. Output: Q10 of (D - 1), so 0 = line, 1024 = filled plane. Plus an aesthetic_q10 derived from Spehar-fit Gaussian-shaped peak at D~1.4 (Q10 dim ~410). Why Q10 of (D - 1) instead of Q10 of D directly: 1.0 < D < 2.0 in every realistic case, so the [1, 2] range maps cleanly to [0, Q10] without wasting integer bits encoding the always-present 1. genealogy_id: mandelbrot_1967_fractal + falconer_1990_geometry + spehar_2003_universal_aesthetic_fractals lineage_id: box_counting_fractal_dim_q10

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_image.nx nx_self_similarity.nx nx_image_feature_extract.nx nx_self_similarity_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_image.nx

imported by: nx_image_feature_extract.nxnx_self_similarity_test.nx

structs

36struct SelfSimilarityReport

consts

none

functions

53func _log2_q10(n: nx_int) -> nx_int
76func _edge_mask_alloc(gray: *Image) -> *i64
126func _box_count(mask: *i64, w: nx_int, h: nx_int, s: nx_int) -> nx_int
156func _edge_density_q10(mask: *i64, w: nx_int, h: nx_int) -> nx_int
175func nx_self_similarity_compute(gray: *Image, report: *SelfSimilarityReport) -> nx_int
248func nx_self_similarity_in_peak_band(report: *SelfSimilarityReport) -> nx_int
called by 1: main