Skip to main content

Module resample

Module resample 

Source
Expand description

Pixel-exact reimplementations of the OpenCV resize kernels docling uses for TableFormer preprocessing, so the model sees byte-identical input. Verified against cv2 on docling’s own bitmaps (INTER_AREA max diff 1/255, INTER_LINEAR < 1e-4 in float).

Enums§

PilFilter
Pillow filter kernels.

Functions§

inter_area
cv2.resize(..., interpolation=INTER_AREA) for shrinking — area-weighted averaging, separable (horizontal then vertical), f64 accumulation.
pil_resize
PIL.Image.resize((dw, dh), resample=filter) for RGB, byte-exact: horizontal pass then vertical pass, uint8 in between, i32 accumulators seeded with the rounding bias (Pillow ImagingResampleHorizontal_8bpc).