Skip to content

Parity report

polars-cv's outputs are checked against independent implementations: OpenCV, SciPy, NumPy, PIL, imagehash and pycocotools, or a written definition where no library computes the same thing. 789 tests over 114 ops ran and passed at commit 27f8c3f on 2026-10-18, with polars-cv 0.39.0, polars 2.0.0, numpy 2.5.3, opencv-python 4.11.0.86, scipy 1.16.3, pillow 12.0.0, imagehash 4.3.2, pycocotools 2.0.11.

Every test declares what it compares and the tolerance it asserts (@pytest.mark.parity in tests/reference/). A reference test without a declaration fails collection, so nothing is checked that this page does not list, and nothing is listed that is not checked. A declared test that never runs polars-cv fails, so a reference checked against itself cannot pass as coverage. CI runs these tests on every push, except the pycocotools check, which needs a package polars-cv does not depend on (CR-79 in ISSUES.md); this page is regenerated with it installed.

By reference

Checked against Tests passing Ops
NumPy 292 abs, add, add_constant, adjust_contrast, adjust_gamma, apply_lut, apply_mask, area, bitwise_and, bitwise_or, blend, cast, ceil, channel_merge, channel_select, channel_swap, clamp_max, clamp_min, convert_color, convolve2d, coordinate_grid, crop, difference, dilate, divide, erode, flip_h, floor, grayscale, histogram, intersection, invert, maximum, minimum, morphology_close, morphology_gradient, morphology_open, multiply, neg, pad, rasterize, reciprocal, reduce_argmax, reduce_argmin, reduce_max, reduce_mean, reduce_min, reduce_std, reduce_sum, round, scale, sign, sqrt, square, subtract, subtract_constant, symmetric_difference, to_bgr, trunc, union
Definition 202 adjust_brightness, adjust_contrast, adjust_gamma, apply_lut, area, assert_shape, blur, boundary, canny, cast, channel_swap, clamp, contour.densify, contour.difference, contour.intersection, contour.iou, contour.offset, contour.smooth, contour.stroke, contour.symmetric_difference, contour.union, contour.union_all, convert_color, convolve2d, densify, difference, dilate, distance_transform, equalize_histogram, erode, grayscale, intersection, invert, morphology_close, morphology_gradient, morphology_open, offset, perceptual_hash, rasterize, sharpen, smooth, sobel, sqrt, stroke, symmetric_difference, to_hsv, to_lab, to_ycbcr, union, union_all, warp_affine
OpenCV 130 apply_lut, blur, canny, contour.area, contour.bounding_box, contour.centroid, contour.contains_point, contour.convex_hull, contour.dice, contour.flip, contour.hausdorff_distance, contour.iou, contour.is_convex, contour.normalize, contour.perimeter, contour.scale, contour.simplify, contour.to_absolute, contour.translate, contour.winding, convert_color, dilate, equalize_histogram, erode, extract_contours, grayscale, laplacian, morphology_close, morphology_gradient, morphology_open, rasterize, rotate_and_scale, sharpen, shear, sobel, stroke, warp_affine
Hand-computed 48 adjust_brightness, adjust_contrast, adjust_gamma, apply_lut, area, channel_select, channel_swap, convert_color, coordinate_grid, difference, grayscale, intersection, invert, offset, on_error, rasterize, resize, stroke, symmetric_difference, union, union_all
SciPy 47 dilate, distance_transform, erode
imagehash 23 perceptual_hash
Python 22 densify, smooth
matplotlib 20 rasterize
pycocotools 4 metrics.evaluate_detections
Cross-check 1 distance_transform, extract_contours, point.signed_distance_to_contour

End to end against PIL

The benchmark runs four real workloads on 40 COCO val2017 images and holds every library to PIL's output before anything is timed. Mean / worst difference from PIL:

Workload (40 COCO images) Unit polars-cv OpenCV torchvision Daft
decode → bilinear 224² → gray levels 0.17 / 2 4.18 / 127 0.66 / 2 1.19 / 23
thumbnail → JPEG, re-decoded levels 2.00 / 4.32 5.70 / 12.27 0.03 / 0.44 n/a
64-bit pHash bits 0.15 / 2 33.62 / 44 n/a 0.50 / 2
per-row crop + bilinear resize levels 0.16 / 2 4.78 / 136 0.00 / 1 n/a

Where the differences come from (from benchmarks/bench/parity.py):

  • JPEG decoding. PIL, OpenCV and torchvision use libjpeg-turbo; polars-cv and Daft use pure-Rust decoders. The same file decodes a level or two apart at chroma edges.
  • Resize. PIL, torchvision, polars-cv and Daft widen the bilinear filter when downscaling. OpenCV's INTER_LINEAR doesn't, so it aliases on a 640 to 224 downscale.
  • Thumbnails are re-encoded JPEGs, so both sides are lossy.
  • pHash. polars-cv follows imagehash's algorithm; its grayscale and Lanczos resize round differently from Pillow's, so a few bits move. OpenCV's img_hash is another variant, so its bits are not comparable, but every library finds the same duplicate groups.

Every comparison

Ops Checked against Tolerance Tests Source
rotate_and_scale OpenCV cv2.getRotationMatrix2D + cv2.warpAffine, 30 degrees, 1.5x, bilinear atol 7 levels 1 test_affine_ref.py
shear OpenCV cv2.warpAffine, bilinear, u8 RGB, x-shear 0.3, random 100x100 atol 5 levels 1 test_affine_ref.py
warp_affine Definition: identity matrix returns the input image unchanged exact 1 test_affine_ref.py
warp_affine Definition: identity warp leaves each channel of a mixed-value RGB image intact exact 1 test_affine_ref.py
warp_affine Definition: nearest and bilinear interpolation give different output under rotation not equal (outputs must differ) 1 test_affine_ref.py
warp_affine Definition: out-of-frame pixels take border_value exact (corner pixel == 128) 1 test_affine_ref.py
warp_affine OpenCV cv2.getRotationMatrix2D + cv2.warpAffine, 90 degrees, bilinear atol 2 levels 1 test_affine_ref.py
warp_affine OpenCV cv2.warpAffine, bilinear, u8 RGB, 2x scale, random 50x50 atol 2 levels 1 test_affine_ref.py
warp_affine OpenCV cv2.warpAffine, bilinear, u8 RGB, translation (50, 30) atol 2 levels 1 test_affine_ref.py
apply_lut Definition: a table no row can use (empty, ragged, out of range) is refused at build exact (raises) 6 test_apply_lut_ref.py
apply_lut NumPy fancy indexing table[image] exact 56 test_apply_lut_ref.py
apply_lut OpenCV cv2.LUT (u8 -> u8, one table for all channels) exact 1 test_apply_lut_ref.py
apply_lut, assert_shape Definition: a palette (K > 1 entries per row) needs a single-channel input exact (raises) 1 test_apply_lut_ref.py
apply_lut, cast Definition: only u8/u16 inputs index a table; float input is refused exact (raises) 1 test_apply_lut_ref.py
apply_lut, clamp Definition: an index past the table is a row error; explicit clamp maps every value exact (raises, then hand-computed values) 1 test_apply_lut_ref.py
apply_lut, grayscale Hand-computed expected values: output dtype and K-channel shape in the plan exact 1 test_apply_lut_ref.py
apply_lut, on_error Hand-computed expected values: only the out-of-range row becomes null exact 1 test_apply_lut_ref.py
add NumPy saturating uint8 add (np.clip of int16 sum) atol 1 1 test_binary_ops_ref.py
add, subtract, multiply, divide, apply_mask, maximum, minimum, bitwise_and, bitwise_or, blend, scale, channel_select, channel_merge NumPy int16-clipped add/subtract, float32 normalized product, float32 division, 0/1 mask product, np.maximum/minimum/bitwise_and/bitwise_or, scalar and per-channel scaling exact except the normalized product (atol 1: polars-cv rounds, the reference truncates) and per-channel weights (rtol 1e-6, f32 vs f64 weights) 13 test_binary_ops_ref.py
apply_mask, grayscale NumPy image times 0/1 mask, u8 atol 1 1 test_binary_ops_ref.py
blend NumPy rounded normalized product (a*b + 127) // 255, u8 atol 1 1 test_binary_ops_ref.py
divide NumPy true division into f32, IEEE inf/NaN at zero rtol 1e-6, NaN equal; dtype f32 1 test_binary_ops_ref.py
multiply NumPy saturating uint8 multiply (np.clip of uint16 product) atol 1 1 test_binary_ops_ref.py
subtract NumPy saturating uint8 subtract (np.clip of int16 difference) atol 1 1 test_binary_ops_ref.py
blur Definition: sigma 0 is the identity (as in PIL, SciPy); sigma < 0, NaN, inf refused exact 9 test_blur_ref.py
blur OpenCV cv2.GaussianBlur, u8 gray and RGB, sigma 1 and 2 mean diff < 0.5, max diff <= 3 levels (smooth images) 4 test_blur_ref.py
canny OpenCV cv2.Canny, aperture 3, L1 gradient (gray, colour, alpha, tiny images) exact (identical edge maps) 44 test_canny_ref.py
metrics.evaluate_detections pycocotools COCOeval bbox summary (mAP, mAP50, mAP75, mAR100), random data abs 1e-12 4 test_coco_parity_ref.py
convert_color Definition: BT.601 luma Y = 0.299 R + 0.587 G + 0.114 B abs diff <= 1 level 1 test_color_ref.py
convert_color Definition: LAB output is f32 exact 1 test_color_ref.py
convert_color Definition: LAB range, L in [0, 100], a and b within +-130 bounds L -1..101, a and b +-130 1 test_color_ref.py
convert_color Definition: RGB -> BGR -> HSV equals RGB -> HSV atol 2 levels 1 test_color_ref.py
convert_color Definition: RGB -> BGR -> RGB recovers the input exact 1 test_color_ref.py
convert_color Definition: RGB -> HSV -> RGB round-trip recovers the input atol 8 levels 1 test_color_ref.py
convert_color Definition: RGB -> HSV -> YCbCr -> RGB recovers the input atol 10 levels 1 test_color_ref.py
convert_color Definition: RGB -> LAB -> RGB round-trip recovers the input (f32, 0-1 scale) atol 2/255 1 test_color_ref.py
convert_color Definition: RGB -> RGB is the identity exact 1 test_color_ref.py
convert_color Definition: RGB -> YCbCr -> RGB round-trip recovers the input atol 3 levels 1 test_color_ref.py
convert_color Definition: an unknown colour space name raises ValueError exact (raises) 1 test_color_ref.py
convert_color Hand-computed expected values: gray (128, 128, 128) has S=0 exact 1 test_color_ref.py
convert_color Hand-computed expected values: planned dtype after HSV is unchanged (auto) exact 1 test_color_ref.py
convert_color Hand-computed expected values: planned dtype after LAB is f32 exact 1 test_color_ref.py
convert_color Hand-computed expected values: pure R, G, B give H=0, 60, 120 (S=V=255) exact 1 test_color_ref.py
convert_color Hand-computed expected values: pure black is L=0, a=0, b=0 abs diff < 1 1 test_color_ref.py
convert_color Hand-computed expected values: pure red is H=0, S=255, V=255 exact 1 test_color_ref.py
convert_color Hand-computed expected values: pure white is L=100, a=0, b=0 abs diff < 1 1 test_color_ref.py
convert_color NumPy BT.601 gray round(0.299 R + 0.587 G + 0.114 B) atol 1 level (fixed-point rounding) 1 test_color_ref.py
convert_color NumPy channel flip rgb[:, :, ::-1] exact 1 test_color_ref.py
convert_color OpenCV cv2.cvtColor BGR2HSV (u8, hue 0-180) S, V atol 2; wrapped hue p99.9 diff <= 2 1 test_color_ref.py
to_bgr NumPy channel flip rgb[:, :, ::-1] exact 1 test_color_ref.py
to_hsv, convert_color Definition: to_hsv() equals convert_color(rgb, hsv) exact 1 test_color_ref.py
to_lab, convert_color Definition: to_lab() equals convert_color(rgb, lab) exact 1 test_color_ref.py
to_ycbcr, convert_color Definition: to_ycbcr() equals convert_color(rgb, ycbcr) exact 1 test_color_ref.py
contour.intersection Definition: a null operand nulls the row exact 1 test_contour_boolean_ref.py
contour.union Definition: single-contour columns yield a contour-set column exact 1 test_contour_boolean_ref.py
difference, area Hand-computed expected values: 10x10 minus an overlapping rectangle is 50 pytest.approx default (rel 1e-6) 1 test_contour_boolean_ref.py
difference, area Hand-computed expected values: 20x20 square minus 4x4 island is 384 pytest.approx default (rel 1e-6) 1 test_contour_boolean_ref.py
difference, intersection, area Hand-computed expected values: a-a empty, overlapping squares area 63 pytest.approx default (rel 1e-6) 1 test_contour_boolean_ref.py
intersection, union, area Hand-computed expected values: island in a ring's hole (areas 16, 300) exact 1 test_contour_boolean_ref.py
intersection, union, area, contour.iou Definition: .contour.iou equals area(a and b) / area(a or b) rel 1e-07 4 test_contour_boolean_ref.py
union Definition: a buffer-domain operand is refused at build time exact (raises ValueError) 1 test_contour_boolean_ref.py
union, intersection, difference, symmetric_difference, area Definition: inclusion-exclusion of the areas of the boolean results rel 1e-07 4 test_contour_boolean_ref.py
union, intersection, difference, symmetric_difference, area Hand-computed expected values: areas of s op empty and empty op s pytest.approx default (rel 1e-6) 4 test_contour_boolean_ref.py
union, intersection, difference, symmetric_difference, contour.union, contour.intersection, contour.difference, contour.symmetric_difference Definition: an open contour operand is refused (no region) exact (raises ComputeError) 8 test_contour_boolean_ref.py
union, intersection, difference, symmetric_difference, contour.union, contour.intersection, contour.difference, contour.symmetric_difference Definition: the .contour accessor equals the pipeline op exact 4 test_contour_boolean_ref.py
union, intersection, difference, symmetric_difference, rasterize, area NumPy pixelwise |, &, & ~, ^ of the rasterized operand masks masks exact; areas pytest.approx default (rel 1e-6) 24 test_contour_boolean_ref.py
contour.area, contour.perimeter, contour.winding, contour.flip, contour.normalize, contour.to_absolute, contour.centroid, contour.bounding_box, contour.convex_hull, contour.is_convex, contour.translate, contour.scale, contour.simplify, contour.contains_point OpenCV cv2.contourArea/arcLength/moments/boundingRect/convexHull/approxPolyDP/pointPolygonTest and NumPy rel 1e-09 on analytic polygon measures (area, perimeter, centroid, transforms); exact for bbox, hull vertices, winding, convexity and containment 21 test_contour_ops_ref.py
densify Definition: a bad per-row length is refused with its row exact (raises) 3 test_contour_shaping_ref.py
densify Definition: a non-positive or non-finite max length is refused at build exact (raises) 2 test_contour_shaping_ref.py
densify Python: split of each edge into ceil(L / max) equal parts atol 1e-9; every edge <= max + 1e-9 9 test_contour_shaping_ref.py
densify, contour.densify Definition: a length past the point budget is refused before running exact (raises) 1 test_contour_shaping_ref.py
offset Definition: a non-finite per-row distance is refused with its row exact (raises) 3 test_contour_shaping_ref.py
offset Definition: an open contour has no region and is refused exact (raises) 1 test_contour_shaping_ref.py
offset Definition: round-offset edges stay within the documented arc bound of distance d max gap <= max(1/64, r (1 - cos(0.01 pi))) + 1e-9 6 test_contour_shaping_ref.py
offset Hand-computed expected values: a square shrunk past its middle is empty exact 1 test_contour_shaping_ref.py
offset, area Definition: round-join area = square + 4 edge strips + pi r^2 (arcs inscribed) exact - 2 pi r 0.0156 <= area <= exact + 1e-6 1 test_contour_shaping_ref.py
offset, area Hand-computed expected values: 10x10 square shrunk by 3 is a 4x4 square (area 16) pytest.approx rel 1e-6 3 test_contour_shaping_ref.py
offset, area Hand-computed expected values: area of a 10x10 square grown by 3, miter and bevel pytest.approx rel 1e-6 2 test_contour_shaping_ref.py
offset, area Hand-computed expected values: dumbbell shrunk by 1.5 splits into two 5x5 squares pytest.approx rel 1e-6 1 test_contour_shaping_ref.py
offset, area Hand-computed expected values: holed square grown by 2 (area 24^2 - 6^2, one hole) pytest.approx rel 1e-6 1 test_contour_shaping_ref.py
offset, area Hand-computed expected values: overlapping members shrink as one region (area 36) pytest.approx rel 1e-6 1 test_contour_shaping_ref.py
offset, area Hand-computed expected values: per-row distance +1 / -1 on a 10x10 square (areas 144, 64) pytest.approx rel 1e-6 1 test_contour_shaping_ref.py
offset, area Hand-computed expected values: two squares grown by 1.5 merge into one 21x11 rectangle pytest.approx rel 1e-6 1 test_contour_shaping_ref.py
offset, rasterize Definition: round offset is {p: signed_distance(p, region) <= d}, NumPy/matplotlib oracle per-pixel band, +-0.0156 px at the boundary 6 test_contour_shaping_ref.py
offset, union_all Definition: offset by 0 equals union_all exact 1 test_contour_shaping_ref.py
offset, union_all, smooth, densify, stroke, contour.offset, contour.union_all, contour.smooth, contour.densify, contour.stroke Definition: a degenerate ring gives a contour set or a named refusal, never a panic no panic (any other ComputeError allowed) 23 test_contour_shaping_ref.py
offset, union_all, smooth, densify, stroke, contour.offset, contour.union_all, contour.smooth, contour.densify, contour.stroke Definition: each .contour accessor equals its pipeline op exact 5 test_contour_shaping_ref.py
rasterize Definition: rasterize refuses a line and names stroke() exact (raises) 1 test_contour_shaping_ref.py
smooth Python: Chaikin corner cutting (reference in the test) atol 1e-9 12 test_contour_shaping_ref.py
smooth Python: Chaikin corner cutting (reference in the test), one pass atol 1e-9 1 test_contour_shaping_ref.py
smooth, contour.smooth Definition: passes past the point budget are refused before running exact (raises) 2 test_contour_shaping_ref.py
smooth, densify, contour.smooth, contour.densify Definition: the point budget applies to the whole row, not per member exact (raises) 2 test_contour_shaping_ref.py
stroke Definition: a bad per-row width is refused with its row exact (raises) 3 test_contour_shaping_ref.py
stroke Definition: a non-positive or non-finite width is refused at build exact (raises) 2 test_contour_shaping_ref.py
stroke Definition: crossing lines stroke to one closed region exact 1 test_contour_shaping_ref.py
stroke Definition: round-cap edges stay within the documented arc bound of radius r max gap <= max(1/64, r (1 - cos(0.01 pi))) + 1e-9 3 test_contour_shaping_ref.py
stroke Hand-computed expected values: an edge-less ring strokes to nothing; a one-point line to a dot exact 1 test_contour_shaping_ref.py
stroke, boundary, rasterize Definition: stroking a region equals stroking its boundary() lines exact 3 test_contour_shaping_ref.py
stroke, rasterize Definition: a closed loop line strokes alike from any start point and any cap exact 6 test_contour_shaping_ref.py
stroke, rasterize Definition: a mixed set strokes as the union (max) of its members' strokes exact 1 test_contour_shaping_ref.py
stroke, rasterize Definition: a one-point line with round caps is a disc of radius width/2 per-pixel band, +-0.0156 px at the boundary 1 test_contour_shaping_ref.py
stroke, rasterize Definition: a region strokes as a band about each ring, no caps per-pixel band, +-0.0156 px at the boundary 1 test_contour_shaping_ref.py
stroke, rasterize Definition: default stroke is a 1 px round line (distance <= 0.5) per-pixel band, +-0.0156 px at the boundary 1 test_contour_shaping_ref.py
stroke, rasterize Definition: round stroke is {p: distance(p, path) <= width/2}, NumPy distance oracle per-pixel band, +-0.0156 px at the boundary 19 test_contour_shaping_ref.py
stroke, rasterize Hand-computed expected values: area of an L stroke per join (miter 80, round 76+pi, bevel 78) abs 0.25 px area, supersample 16 3 test_contour_shaping_ref.py
stroke, rasterize Hand-computed expected values: butt and square caps on a grid-aligned segment (mask) exact 2 test_contour_shaping_ref.py
stroke, rasterize Hand-computed expected values: mask of a grid-aligned mitered L stroke exact 1 test_contour_shaping_ref.py
union_all Definition: an open contour has no region and is refused exact (raises) 1 test_contour_shaping_ref.py
union_all Definition: the union of an empty set is empty exact 1 test_contour_shaping_ref.py
union_all, area Hand-computed expected values: ring plus island stays two regions (areas 16, 256) pytest.approx default (rel 1e-6) 1 test_contour_shaping_ref.py
union_all, area Hand-computed expected values: ring plus plug is one hole-free region (area 400) pytest.approx default (rel 1e-6) 1 test_contour_shaping_ref.py
union_all, rasterize, area Definition: rasterizing union_all equals rasterizing the set masks exact; areas pytest.approx default (rel 1e-6) 5 test_contour_shaping_ref.py
coordinate_grid NumPy np.meshgrid of pixel centres (x + 0.5, y + 0.5), optionally / (W, H) exact 22 test_coordinate_grid_ref.py
coordinate_grid, add_constant, square NumPy (np.meshgrid centres - 4.5) ** 2 rtol 1e-6 1 test_coordinate_grid_ref.py
coordinate_grid, crop NumPy np.meshgrid of pixel centres (x + 0.5, y + 0.5), cropped before or sliced after exact 1 test_coordinate_grid_ref.py
coordinate_grid, flip_h NumPy np.meshgrid of pixel centres (x + 0.5, y + 0.5) exact 1 test_coordinate_grid_ref.py
coordinate_grid, resize Hand-computed expected values: planned shape (5, 7, 2) and dtype f32 exact 1 test_coordinate_grid_ref.py
distance_transform Definition: all-zero image is 0 unsigned and +inf signed exact 1 test_distance_transform_ref.py
distance_transform Definition: with no zero pixel the distance is +inf (-inf signed) exact 1 test_distance_transform_ref.py
distance_transform SciPy scipy.ndimage.distance_transform_edt composition (d_out - 0.5 outside, -(d_in - 0.5) inside) exact (f32) 8 test_distance_transform_ref.py
distance_transform SciPy scipy.ndimage.distance_transform_edt, [H, W, 1] input exact (f32) 1 test_distance_transform_ref.py
distance_transform SciPy scipy.ndimage.distance_transform_edt, all 10 numeric dtypes, unsigned and signed exact (f32) 10 test_distance_transform_ref.py
distance_transform SciPy scipy.ndimage.distance_transform_edt; OpenCV cv2.distanceTransform (DIST_L2, precise) SciPy: exact (f32); OpenCV: within 1 ulp 8 test_distance_transform_ref.py
distance_transform, extract_contours, point.signed_distance_to_contour Cross-check: vector .point.signed_distance_to_contour on the extract_contours outline "atol 1e-5 on edges; corner overshoot <= (sqrt 2 - 1)/2" 1 test_distance_transform_ref.py
distance_transform, grayscale Definition: the plan publishes f32 output of the input rank exact 1 test_distance_transform_ref.py
extract_contours OpenCV cv2.findContours (RETR_EXTERNAL/LIST/TREE, CHAIN_APPROX_NONE/SIMPLE/TC89) on the same mask exact: contour count, bounding box under the pixel-edge vs pixel-centre mapping, area == mask pixel count, vertex count where the conventions coincide 13 test_extract_ref.py
histogram NumPy np.histogram (counts, edges, density) and np.digitize (quantized) exact for counts and quantized indices; rtol 1e-12 for edges and normalized 11 test_histogram_ref.py
erode Definition: a footprint other than disk or square is refused exact (raises) 1 test_morphology_disk_ref.py
erode NumPy sliding window np.min over the disk (NaN propagates) exact (NaN mask) 1 test_morphology_disk_ref.py
erode, dilate NumPy sliding window np.min/np.max over the disk, edges replicated exact 100 test_morphology_disk_ref.py
erode, dilate SciPy scipy.ndimage.distance_transform_edt thresholded at the disk radius exact 16 test_morphology_disk_ref.py
erode, dilate SciPy scipy.ndimage.grey_erosion/grey_dilation, disk footprint, nearest exact 4 test_morphology_disk_ref.py
erode, dilate, morphology_gradient Definition: footprint="square" is the default footprint exact 1 test_morphology_disk_ref.py
morphology_gradient, morphology_open, morphology_close NumPy disk window erode/dilate, composed per the definition of each op exact 3 test_morphology_disk_ref.py
erode, dilate, morphology_open, morphology_close, morphology_gradient, grayscale Definition: builder lowers open to erode+dilate, close to dilate+erode; domain and dtype kept; no execution exact 7 test_morphology_ref.py
grayscale, dilate Definition: dilate with ksize=1 returns the input unchanged exact 1 test_morphology_ref.py
grayscale, dilate OpenCV cv2.dilate, 3x3 rect kernel, u8 gray (1 and 2 iterations) exact 3 test_morphology_ref.py
grayscale, erode Definition: erode with ksize=1 returns the input unchanged exact 1 test_morphology_ref.py
grayscale, erode Definition: erosion of an all-zero mask is all zero exact 1 test_morphology_ref.py
grayscale, erode OpenCV cv2.erode, 3x3 rect kernel, u8 gray (1 and 2 iterations) exact 3 test_morphology_ref.py
grayscale, morphology_close OpenCV cv2.morphologyEx MORPH_CLOSE, 3x3 rect kernel, u8 gray exact 1 test_morphology_ref.py
grayscale, morphology_gradient OpenCV cv2.morphologyEx MORPH_GRADIENT, 3x3 rect kernel, u8 gray exact 1 test_morphology_ref.py
grayscale, morphology_open OpenCV cv2.morphologyEx MORPH_OPEN, 3x3 rect kernel, u8 gray exact 1 test_morphology_ref.py
contour.iou, contour.dice, contour.hausdorff_distance, contour.contains_point OpenCV drawContours masks / cv2.pointPolygonTest, SciPy directed_hausdorff IoU/Dice abs 0.01 vs edge-inclusive OpenCV masks and rel 1e-09 vs the analytic value; Hausdorff rel 1e-9 vs SciPy; containment exact 14 test_pairwise_ref.py
perceptual_hash Definition: distinct images spread near 32 of 64 bits apart Hamming bits: mean > 26, min > 6 1 test_perceptual_hash_ref.py
perceptual_hash imagehash phash (64-bit, hash_size=16 for 256 bits), average_hash and dhash on the same images Hamming bits: phash <= 4 (<= 12 on a colour gradient), 256-bit <= 40, average/difference <= 10 on smooth images 18 test_perceptual_hash_ref.py
perceptual_hash imagehash phash (default 64-bit, and hash_size=16 for 256 bits) Hamming bits: <= 2 at 32x32, exact on flat/gradient, <= 4 resized, <= 40 of 256 4 test_perceptual_hash_ref.py
perceptual_hash imagehash phash, average_hash and dhash, bits read most significant first <= 2 Hamming bits for every algorithm 1 test_perceptual_hash_ref.py
adjust_brightness Definition: brightness factor 1.0 preserves values (u8 -> f32) atol 1e-4 1 test_phase1_ref.py
adjust_brightness Hand-computed expected values: 200 * 2.0 saturates at 255 atol 1e-4 1 test_phase1_ref.py
adjust_brightness Hand-computed expected values: lowers to scale then clamp exact 1 test_phase1_ref.py
adjust_contrast Definition: contrast factor 1.0 is the identity (u8 -> f32) atol 1e-4 1 test_phase1_ref.py
adjust_contrast Hand-computed expected values: planned dtype u8 -> f32 exact 1 test_phase1_ref.py
adjust_contrast NumPy (img - mean) * factor + mean in f32 atol 1e-2 1 test_phase1_ref.py
adjust_gamma Definition: gamma 1.0 is the identity (u8 -> f32) atol 1.0 level 1 test_phase1_ref.py
adjust_gamma Hand-computed expected values: planned dtype u8 -> f32 exact 1 test_phase1_ref.py
adjust_gamma NumPy np.power(img / 255, gamma) * 255 in f32 atol 1.0 level 1 test_phase1_ref.py
channel_select Hand-computed expected values: the domain stays buffer exact 1 test_phase1_ref.py
channel_select NumPy indexing img[:, :, i:i+1] exact 3 test_phase1_ref.py
channel_swap Definition: swap order [0, 1, 2] is the identity exact 1 test_phase1_ref.py
channel_swap Hand-computed expected values: the domain stays buffer exact 1 test_phase1_ref.py
channel_swap NumPy channel reversal img[:, :, ::-1] exact 1 test_phase1_ref.py
invert Definition: inverting twice recovers the input exact 1 test_phase1_ref.py
invert Hand-computed expected values: planned dtype is not promoted exact 1 test_phase1_ref.py
invert NumPy 255 - img on u8 exact 1 test_phase1_ref.py
invert NumPy bitwise not ~x for every integer dtype (u8-i64) exact 8 test_phase1_ref.py
pad NumPy np.pad(mode="reflect"), three channels exact 1 test_phase1_ref.py
pad, grayscale NumPy np.pad(mode="reflect") exact 1 test_phase1_ref.py
pad, grayscale NumPy np.pad(mode="symmetric") exact 1 test_phase1_ref.py
canny Definition: Canny output is u8 containing only 0 and 255 exact (values in {0, 255}) 1 test_phase3_ref.py
canny Definition: edges appear around a bright rectangle, none inside it edge max == 255; interior sum 0 or mean < 10 1 test_phase3_ref.py
convolve2d Definition: an identity kernel keeps all 3 channels of an RGB image (as f32) atol 0.5 1 test_phase3_ref.py
convolve2d, sobel Definition: even or non-square kernels, unknown border and unknown sobel axis are refused exact (raises ValueError) 4 test_phase3_ref.py
grayscale, convolve2d Definition: a 3x3 identity kernel reproduces the input (as f32) atol 0.5 1 test_phase3_ref.py
grayscale, convolve2d Definition: zero and reflect border modes run and return a result (values not compared) none (result is not None) 2 test_phase3_ref.py
grayscale, convolve2d NumPy mean of the 3x3 neighbourhood at one interior pixel, f32 output atol 0.5 (one pixel) 1 test_phase3_ref.py
grayscale, equalize_histogram Definition: equalizing a low-contrast image widens its value range strict inequality (output range > input range) 1 test_phase3_ref.py
grayscale, equalize_histogram Definition: the equalized 16-bin histogram is near uniform chi-squared-like measure < 2.0 1 test_phase3_ref.py
grayscale, equalize_histogram OpenCV cv2.equalizeHist, u8 gray exact 1 test_phase3_ref.py
grayscale, laplacian OpenCV cv2.Laplacian, ksize=1, CV_32F, interior only (1 px margin) atol 1.0 1 test_phase3_ref.py
grayscale, sharpen Definition: sharpening raises the mean absolute horizontal gradient strict inequality (sharpened > original) 1 test_phase3_ref.py
grayscale, sharpen OpenCV cv2.filter2D, 3x3 sharpen kernel, BORDER_REPLICATE, f32 gray atol 1e-3 (full image) 3 test_phase3_ref.py
grayscale, sobel OpenCV cv2.Sobel, CV_32F, x and y, interior only (2 px margin) atol 1.0 2 test_phase3_ref.py
sharpen OpenCV cv2.filter2D, 3x3 sharpen kernel, BORDER_REPLICATE, f32 RGB atol 1e-3 (full image) 1 test_phase3_ref.py
rasterize, stroke OpenCV cv2.drawContours (filled, thickness=1 outline, holes punched with value 0) on the same contours exact for axis-aligned shapes (far edges at b + 1 for OpenCV's inclusive pixels) and for the 1px outline; diagonal/curved edges differ on boundary pixels only, <= the perimeter (measured ~0.48x) 10 test_rasterize_ref.py
rasterize Definition: supersample outside 1..16 is refused at build exact (raises ValueError) 2 test_rasterize_supersample_ref.py
rasterize Definition: supersample=1 equals the default centre rule exact 1 test_rasterize_supersample_ref.py
rasterize Hand-computed expected values: edge at x = 2.25 / 5.75 covers 3/4 of a pixel (191) exact 1 test_rasterize_supersample_ref.py
rasterize Hand-computed expected values: fill 0 on background 200 with half-covered pixels (100) exact 1 test_rasterize_supersample_ref.py
rasterize Hand-computed expected values: per-row supersample 1 and 2 give 255 and 128 for a half-covered pixel exact 1 test_rasterize_supersample_ref.py
rasterize matplotlib Path.contains_points at each n x n sub-pixel centre, holes subtracted exact (u8 mask, n = 1..8) 20 test_rasterize_supersample_ref.py
reduce_max, reduce_min, reduce_mean, reduce_std, reduce_sum, reduce_argmax, reduce_argmin NumPy np.max/min/mean/std/sum/argmax/argmin on a random u8 RGB image exact for max/min/argmax/argmin/sum; rtol 1e-9 for mean/std 17 test_reductions_ref.py
neg, abs, sqrt, square, reciprocal, sign, floor, ceil, round, trunc, clamp_min, clamp_max, add_constant, subtract_constant, cast, scale NumPy elementwise ufuncs (np.abs, np.sqrt, np.round, ...) on a signed f32 base rtol 1e-5, atol 1e-5, NaN equal 14 test_scalar_math_ref.py
sqrt Definition: a scalar op on a u8 image promotes to f32 exact (dtype) 1 test_scalar_math_ref.py

Reproduce

cd polars-cv
uv run --no-sync --with pycocotools python scripts/parity_report.py

It runs the reference suite, refuses to write anything if a test fails or is skipped, and regenerates this page and the README summary.