A Practical OpenCV Preprocessing Stack for Warehouses

Published 2026-06-20 by Faraz Rahimi

The unglamorous stack that has survived real aisles: resize, reject blur, stretch contrast, crop the item, then and only then run the matcher.

A Practical OpenCV Preprocessing Stack for Warehouses

Tags: OpenCV, Python, Computer Vision, Warehouse, unlisted

Every time I skipped preprocessing because the model was "modern," the floor sent me blurry orange rectangles and asked why the app was drunk.

My default stack is boring on purpose. Downscale so the long edge is around 720. Variance check for blur. Convert and contrast-limit. Try a grab-cut or a simple center crop if the item is obvious. Stop if the frame is junk.

Order matters

If you contrast-stretch a blown-out dock-door photo, you stretch noise. Reject first. If you embed before crop, you embed the pallet jack in the background and then wonder why SKUs drift toward "warehouse."

I unit-test preprocessing on a folder of known-bad photos. That folder is more valuable than another training epoch.

Keep the original

You will change this stack. Store the original upload. Replaying last week's failures through a new preprocess is how you improve without going back to the aisle with a clipboard.

Original post: https://farazrahimi.com/posts/a-practical-opencv-preprocessing-stack-for-warehouses