Measure fine detail
Give it a box and several stills or video frames of the same picture: the source first, then its edits, renders or grain variants. You get one detail number per input, and its ratio to the first. The frame is fitted to 1920×1080, the box is cut from its greyscale, and the score is the standard deviation of a 4-neighbour high-pass over it. Grain, pores, hair strands and print push it up. Smoothing pulls it down. Use it to compare like with like. It doesn't grade one picture on its own.
Run it
Write references/detail.md's script into the project folder as detail.py,
as is, and run it with exec python:
exec python detail.py --box 760,60,1144,380 --image <source>_first.jpg <swap>_a.png <swap>_b.png
exec python detail.py --box 760,60,1144,380 --video <source shot>.mp4 <take>.mp4 --frame 12
--box left,top,right,bottomis in 1080p pixels. Pick a face or a flat patch (a wall, a sleeve) that shows the same thing in every input.- With
--imageand--videotogether, the first image is the reference. --framepicks the same frame index from every video.
What you get
JSON per input: detail, and vs_first, the ratio to the reference.
Reading the numbers
- A full-frame edit made at 4K and scaled down to 1080p read 0.96 on a face where the source read 2.16. Its grain and a moustache were gone. The same edit made at 2K read 3.19 and kept them. A drop to about half the source is visible smoothing.
- Above the source is not automatically better. Added grain and compression noise raise it too. Look at a 100% crop to tell grain from noise.
- Grain ladder: measure the source and every grain strength on the same flat patch. Pick by eye from 100% crops, using the number to narrow the rungs. Grain vanishes when the crop is scaled down. Grain in post won't fix shine that is in the lighting.
Tips and traps
- Same box, same content. A box that catches an edge or a moving hand in one input and not another measures the edge, not the texture.
- Inputs that aren't 16:9 are centre-cropped to 16:9 before the box is cut, so set the box in that fitted frame.
- Pinning both first and last frames keeps small detail from degrading across a shot. Measure the pinned stills before animating, so a smoothed edit is caught before it costs a render.
Check it
Run it with the source as both inputs. Both read the same value and vs_first is
1.0. A box under a few pixels across is refused.


