14 / 14 · audits

Physicality Audit

A per-pixel certificate of physical impossibility: colors no diffuse surface could show under any declared illuminant.

figure generated by the instrument itself. hover to let the light in.

The problem

Illuminant-consistency forensics estimates lighting per image region and flags disagreement, a statistical anomaly score that an expert can argue with. A cleaner statement is available: a pixel whose implied object color falls outside the object-color solid of every illuminant in a declared family cannot be a diffuse reflective surface under that family at all, because no reflectance in [0,1] produces it. That is a physical impossibility, not an anomaly, and nothing shipped it as a per-pixel certificate.

The method

Each sRGB pixel is converted to XYZ and interpreted relative to a diffuse white at the declared exposure. For every illuminant in the family, named CIE illuminants plus blackbody BB<kelvin> and Gaussian LED<nm> bands, the engine tests whether any reflectance in [0,1] on the canonical 38-sample grid reproduces the pixel's response; realizable under at least one family member means physically fine. For a pixel realizable under none, a binary search finds its overshoot, the factor by which it is over-bright for any surface under any declared light, so 1.3 means 30 percent past the physical bound. A 3 percent boundary tolerance absorbs the known mismatch between the sRGB primary white and the table-integrated D65 white, so exact-boundary whites are not flagged on numerical noise. The response reports counts, per-pixel overshoot, and the worst offenders.

What it promises

  • A flag is a certificate, not a suspicion: the flagged pixel is produced by no reflectance in [0,1] under any illuminant of the declared family at the stated exposure.
  • Every flag is quantified: per-pixel overshoot states the smallest dimming that would make the pixel physical, and the worst offenders come ranked.
  • The scope statement ships inside the response itself: flagged means not a plain diffuse surface, never fake image, and that note travels with every result.

Calling it

{
  "tool": "audit_image_physicality",
  "arguments": {
    "pixels": [
      [
        0.98,
        0.97,
        0.99
      ],
      [
        0.91,
        0.32,
        0.24
      ]
    ],
    "basis": [
      "D65",
      "A",
      "BB3200"
    ],
    "exposure": 0.8
  }
}

Clone the maryslab repo, run cd mcp && npm install && npm run build, then claude mcp add maryslab -- node mcp/dist/server.js

A worked example

Could these pixels be diffuse surfaces under daylight at this exposure?

what was asked

{
  "pixels": [
    [
      0.42,
      0.31,
      0.26
    ],
    [
      0.98,
      0.97,
      0.99
    ],
    [
      0.05,
      0.92,
      0.28
    ]
  ],
  "basis": [
    "D65"
  ],
  "exposure": 0.7
}

what the engine answered

{
  "total_pixels": 3,
  "physically_impossible": 2,
  "fraction": 0.6666666666666666,
  "overshoot": [
    1,
    1.4184790137138108,
    1.1000107422924053
  ],
  "worst_pixels": [
    {
      "index": 1,
      "overshoot": 1.4184790137138108
    },
    {
      "index": 2,
      "overshoot": 1.1000107422924053
    }
  ],
  "illuminant_family": [
    "D65"
  ],
  "exposure": 0.7,
  "note": "A flagged pixel cannot be produced by ANY reflectance in [0,1] under ANY illuminant of the declared family at the given exposure. Fluorescent materials, direct light sources, and specular clipping legitimately exceed the bound — this certifies \"not a plain diffuse surface\", never \"fabricated image\" by itself.",
  "meta": {
    "engine_version": "0.4.1",
    "engine_backend": "reference-ts",
    "dataset_snapshot": "usgs-splib07a-1",
    "compute_device": "cpu"
  }
}

how to read it

A flag means no reflectance in [0,1] produces that pixel under any declared light — not that the image is fake. overshoot says how far past the physical bound it sits.

Produced by running audit_image_physicality at build time (36 ms). Long arrays are truncated for reading; nothing else is edited.

Known limits

  • The certificate assumes non-fluorescent, non-emissive surfaces: fluorescent materials, direct light sources, and specular clipping legitimately exceed the bound, so a flag means not a plain diffuse surface, never fabricated image by itself.
  • Everything is stated relative to the declared exposure, since pixels are read against a diffuse white at that scale; guess the exposure wrong and verdicts shift, which is why per-pixel overshoot is reported rather than a bare flag.
  • The illuminant family is only what you declare, at most four members, with Gaussian LED bands as crude stand-ins for real primaries, and the 3 percent boundary tolerance means hairline violations are deliberately left unflagged.