Blueprint of an in-cab BOL photo passing a quality gate into a rectified page image
Applied AI Systems Architecture

Computer Vision Pre-Processing for Mobile In-Cab BOL and POD Capture

This is the image front end only. It decides whether a cab photo of a bill of lading or a proof of delivery can be rectified, and it stores that image with a quality score.

Matching the page to an order is a later step, described in the logistics computer vision architecture. Nothing here posts an invoice.

Drivers photograph paperwork on a steering wheel, a dash, or a dock clipboard. The pixels that arrive are skewed, crumpled, partly covered, or shot at night. A recognition engine pointed at those pixels will invent characters. The corrective design is a gate in front of recognition: measure the page, repair only the geometry and the illumination that can be repaired without touching the ink, and send the driver back for a retake when the ink is not actually in the frame. Any pixel count or percent below is illustrative. A fleet replaces it with a threshold measured on its own photos.

Key takeaways
  • No OCR call runs until the quality gate returns enhance or accept on the page region.
  • Crumple, glare, thumb, skew, thermal fade, and night noise each need their own gate. One quality lamp hides them.
  • Enhance is reversible geometry or illumination. Occlusion, blur, and clipped glare are rejects, never reconstructions.
  • The archive is the rectified color or grayscale image. Binarization is only an OCR convenience copy.
  • The output is a rectified image, the original hash, and a scored set of components. It is not a posted invoice.
1,200 pxillustrative short-edge floor on the isolated page
8%illustrative clipped-glare area that forces a reject
6cab failure modes the golden set must cover
2illustrative automatic attempts before a clerk path

Where in-cab capture fails

Crumple is a surface problem, not a focus problem. A bill of lading folded into a pocket carries ridges that catch the cab light. Along each ridge the paper flips from bright to dark in a few pixels, and a global threshold will break a character that crosses the ridge. The page is still readable to a person who tilts it. A pipeline that only scores sharpness will pass the crumple and then lose the line. The front end has to detect a high-frequency shading pattern that follows a crease, separate from text, and either correct a slow component of that shading or reject the frame when the crease cuts through handwriting.

The other cab failures are just as specific. Glare from the windshield or a dome light clips ink to white in a blob, and clipped pixels cannot be recovered because the ink values are gone. A thumb or a palm is occlusion: the paper edge is interrupted and the text underneath is not in the file. Skew is rotation in the plane of the image, common when the phone is held in one hand. Thermal fade shows up on heat-printed receipts and on some delivery tickets that have lived on a dashboard. The strokes are faint but geometrically sharp. Night ISO noise is the opposite shape: the phone raises gain, grain fills the background, and a blur metric that counts edges can call a noisy frame sharp. Each of these has a different gate. One "image quality" lamp will hide four of them.

Quality gate before any OCR

No optical character recognition call runs until the gate returns enhance or accept. The gate measures the page region, not the whole photo. A short-edge pixel count is the length of the shorter side of the detected page quadrilateral, in pixels, after the page is isolated from the seat, the window, and the driver's arm. An illustrative floor many imaging teams start from is on the order of 1,200 pixels on that short edge, which is enough for typical bill-of-lading type if the page fills the quad. A frame can be 12 megapixels and still fail if the document is a small region in the corner. The count is recomputed after a perspective warp, because the warp can spread a small page across more pixels without adding real detail. The second measurement is the one that decides.

Blur is a focus and motion score on the page region, often implemented as the variance of a Laplacian, and the floor is meaningless until it is calibrated on that phone model. Night noise inflates edge energy, so the blur score is paired with a noise estimate. If noise is high and blur is "good," the gate still rejects. Duplicate frames are the third check. A burst from a camera button, or a retry that uploads the same JPEG twice, must not open two work items. The gate compares an exact hash of the file bytes and a perceptual hash against the last frames in that capture session. A match drops the duplicate and points at the first artifact. It does not mean the first artifact was good. A duplicate of a rejected photo is still rejected. The driver sees one reason, not a stack of identical failures.

Image front end
Cab photoOriginal bytes stored and hashed
Quality gateShort edge, blur, noise, duplicates, glare, occlusion
RectifyDeskew, perspective warp, stroke-safe illumination
Artifact and scoreRectified image with visible score components
Downstream matchOrder matching on the companion architecture page
A reject at any step returns a specific retake reason to the driver.

Deskew before the page is read

Deskew rotates the page so text baselines sit horizontal. The angle can come from the longer page edges, or from the dominant baseline of printed rules, but it should not come from a single line of handwriting. A signature slopes. A folded corner slopes. Using either as the page angle will rotate a straight document into a diagonal and then feed that diagonal to a later warp that compounds the error. The estimator returns an angle and a confidence. Low confidence is a reject, not a guess of zero degrees. Zero is a real answer only when the edges agree that the page is already level.

Rotation must not crop content. The output canvas grows so the corners of the page remain inside the frame, with a small margin that is background, not a sliced border of text. Interpolation is ordinary image resampling. It is not a license to sharpen. A mild deskew, an illustrative band being under about 12 degrees with confident edges, is a safe enhance. A steep angle usually means the page was photographed badly and the short edge will fail the pixel test after rotation. In that case the deskew is skipped and the reason code is skew, so the retake instruction tells the driver to hold the phone over the page rather than to "try again" with no guidance.

Perspective warp from page edges

A deskew cannot fix a photo taken from the driver's seat at an oblique angle. Perspective warp finds the four edges of the page, builds a quadrilateral, and maps that quad onto a rectangle. The rectangle's aspect should follow the detected page, not a forced letter size, because a proof of delivery can be a half sheet, a thermal strip, or a full bill of lading. Forcing every document into the same aspect stretches type and moves handwriting relative to printed boxes. The homography is accepted only when all four edges are present and the quad is convex. Three edges, a quad that crosses itself, or a quad that is mostly windshield are rejects.

The warp is geometry. It does not fill missing paper. If a thumb covers a corner, the edge detector will either follow the thumb or drop the corner. Both results fail the four-edge test, and the correct action is a retake. Painting a plausible corner back in would create paper that was not photographed and could invent or erase a stamp that sat under the hand. After a confident warp, the short-edge pixel count and the blur score run again on the rectified page. Teams that score only the original photo will pass a warp that turned a small, sharp document into a large, soft one. The quality score stored with the artifact uses the post-warp measurements, and it keeps the pre-warp measurements beside them so a reviewer can see what the warp did.

The warp is geometry. It does not fill missing paper.

If a thumb covers a corner, the correct action is a retake. The pipeline must not reconstruct hidden text, stamps, or amounts.

Shadow removal that preserves a pen stroke

Cab lighting is a slow gradient: a bright patch near the window, a dark band under the mirror, a soft shadow from the phone itself. Illumination correction estimates that slow background and lifts it so the page is closer to even. The estimate has to be slower than a pen stroke. A pen stroke, a ballpoint signature, and a stamp are thin dark structures. If the background estimate is allowed to follow those structures, the correction will lift the ink along with the shadow and the stroke disappears. The safe pattern is a wide background estimate, a subtraction that affects low-frequency shading, and a stop when a probe patch on a known dark stroke would lose contrast.

The stop is the product requirement. Before the corrected image replaces the rectified image, the pipeline compares stroke contrast on a small set of the darkest thin components. If contrast would fall below a floor the fleet sets, the enhancement is discarded and the reason is stroke risk. The uncorrected rectified image remains the candidate, and if that image itself fails the gate, the frame is a reject. This page does not describe a method for removing a signature, a stamp, or an amount. Those marks are the evidence. A shadow step that cannot prove it left them alone does not ship. Creases that are sharp rather than slow are not treated as illumination. They stay visible, and if they cut through handwriting the frame is a reject instead of a beautified file.

Adaptive contrast and binarization

Thermal fade and uneven ink need local contrast, not one threshold for the whole page. A global threshold picks a single cutoff. On a cab photo that cutoff keeps the bright half and punches holes in the dark half, or the reverse. Adaptive binarization computes a local cutoff so a faint thermal line and a heavy printed box can both survive. The name of the method matters less than the archive rule: the black and white image is a convenience copy for a downstream reader. The system of record keeps the rectified color or grayscale file. A later dispute, a customer asking to see the proof of delivery, or a second opinion from a clerk has to look at pixels that still contain the pen, not at a bitmap that already decided what was ink.

Archive rule

The black and white image is a convenience copy for a downstream reader. The system of record keeps the rectified color or grayscale file.

Binarization also has a stroke check. A light blue pen often sits close to the paper in luminance and vanishes when the image is forced to black and white. The front end can increase local contrast on the grayscale copy to help a person read it, but it should not claim the binary copy is complete. If the color image shows a signature and the binary image does not, the binary image is withheld from recognition and the score component for ink preservation fails. Sharpening that adds dark pixels where the original was smooth is out of bounds. Blur is a retake, not an invitation to draw a cleaner character. The output of this stage is still an image plus a note that binarization helped or was withheld. It is not text.

Reject versus enhance

Enhance means a geometry or illumination change that a reviewer can reverse, with the original bytes stored beside the result. Reject means the driver or a clerk must supply a better frame. The dangerous middle is an automatic "cleanup" that paints over occlusion, sharpens blur into new strokes, or lifts ink because a shadow filter was too aggressive. That middle is closed. The table lists illustrative actions a fleet can encode. Every number is a starting example for a policy discussion, not a calibrated constant, and not a claim about any phone, camera, or document stock.

Order matters. Duplicate detection runs first so a burst does not consume review time. Occlusion and glare run before warp, because a warp will cheerfully stretch a thumb into a page corner. Deskew and perspective run only when edge confidence is high. Illumination and contrast run last, and only if the stroke probe passes. A frame can be rejected after a warp if the post-warp short edge or blur fails. The reason code stored is the first hard failure, plus any later failures, so the retake text is specific. "Bad image" is not a reason code.

  1. Duplicate detection. Runs first so a burst does not consume review time.
  2. Occlusion and glare. Run before warp, because a warp will stretch a thumb into a page corner.
  3. Deskew and perspective. Run only when edge confidence is high. Post-warp short edge and blur are rechecked.
  4. Illumination and contrast. Run last, and only if the stroke probe passes.

Enhance

  • Reversible geometry or illumination changes
  • Original bytes stored beside the result
  • A specific reason code on every reject

Never

  • Paint over occlusion
  • Sharpen blur into new strokes
  • Lift ink with an aggressive shadow filter
Illustrative reject versus enhance actions for in-cab paperwork photos. Thresholds are examples, not a device standard.
Condition Illustrative signal Action
Short page edge Under about 1,200 pixels after isolation Reject and ask for a closer photo
Borderline detail About 1,200 to 1,600 pixels and blur passes Enhance geometry only, keep the color original
Blur or motion Below the fleet blur floor Reject. Do not sharpen new strokes into the page
Duplicate frame Same file hash or perceptual hash in the session Keep the first item. Do not open a second one
Glare Clipped area over about 8 percent of the page Reject. Clipped ink is not recoverable
Thumb or occlusion Non-page region inside the quadrilateral Reject. Do not reconstruct hidden text
Soft shadow Slow gradient and the stroke probe still passes Illumination correction, then store both images
Stroke at risk Pen contrast would fall below the fleet floor Discard the enhancement. Reject if the original also fails

A rectified image and a quality score

The contract of this page is small. The artifact is a rectified image, the original file hash, the pipeline version, and a quality score whose components are visible. Useful components are edge confidence, short-edge pixels before and after warp, blur, noise, glare fraction, occlusion flag, duplicate flag, and stroke-preservation result. A single 0 to 100 number may be shown to a product screen if the components sit behind it. A number without components cannot drive a retake instruction and cannot be audited when a clerk disagrees. The score is not a probability that the bill of lading "matches" a load. This front end has not read the load.

Downstream work starts only on an accept or an enhance that passed the stroke check. That work, including how a rectified bill of lading or proof of delivery is tied to an order, is documented in the companion architecture for logistics document vision. This page does not rebuild that match, does not extract a PRO, and does not approve a charge. Billing clerks still see an image. They do not see a posted invoice created by a preprocessor. If a team wants a field reader later, it consumes the rectified archive and the score, and it refuses the frame when the score says reject. Skipping the gate because a reader returned high confidence on a blurry crop is how wrong amounts enter a billing queue.

Idempotency by image hash

Mobile networks retry. A driver in a yard with a weak signal will upload the same photo twice, and a gateway will sometimes deliver the same object twice. The idempotency key is a cryptographic hash of the original bytes, SHA-256 being the usual choice, together with the pipeline version. The same key returns the same rectified artifact, the same score, and the same reason codes. It does not create a second work item, a second thumbnail, or a second task for a clerk. The perceptual hash used for near-duplicate bursts is a separate key. It can collapse a recompressed copy inside one session, but it must not replace the byte hash as the storage identity, because two different documents can sit close in perceptual space if they share a printed form.

Reprocessing is explicit. When the warp or the shadow step changes, the pipeline version changes, and a job may recompute artifacts for stored originals. That job writes a new result under the new version. It does not overwrite the version a clerk already looked at. Audit needs both. The original bytes are immutable. If a device resamples the photo before upload, the hash identifies what the server received, and the capture record should also store the device's own identifier for the shot when the app provides one. Idempotency is what keeps a retry from looking like two proofs of delivery for one stop.

The human retake path

A reject is a message a driver can act on in a cab, in daylight or at night, without learning imaging vocabulary. The text comes from the reason code: move closer, move the thumb, turn away from the glare, hold still, get all four corners, or reshoot because the page is too faded to read. One retake is automatic. If the second frame fails, the flow stops looping and offers a path to a clerk, with both failed images attached. Looping a driver through six rejects trains the driver to photograph anything that will clear the lamp, including a different sheet. The cap is a product decision. An illustrative cap of two automatic attempts is a planning example, not a study of driver behavior.

Failed images are kept. They are the negative examples in the golden set, and they are the audit trail if someone later claims the app discarded a readable proof of delivery. A clerk can accept a failed image only by looking at it and recording why the gate was wrong, for example a form that is legitimately narrow and tripped the short-edge rule. That acceptance does not delete the score. It adds a human disposition. The clerk cannot paint on the image. If the page is truly unreadable, the disposition is "obtain a new document from the counterparty," which is an operations step, not an imaging step. The front end never fabricates a replacement page.

Evaluation on a golden set of cab photos

A golden set is a held-out collection of real in-cab photos, labeled by a person, used to test the gate. The labels are reject, enhance, or accept, plus a yes or no on whether the signature, the amounts, and the reference numbers remain legible after enhancement. The set has to include the failures named on this page: crumple, cab glare, thumb, skew, thermal fade, and night ISO noise. A set shot on a sunny dock will show a flattering accept rate and will miss the night path entirely. Labels are assigned on the original pixels. The labeler does not clean the photo up first. The carrier uses images it has a right to retain for testing, under its own privacy and customer terms, and this page does not supply sample freight documents.

Tuning and evaluation stay apart. Thresholds for blur, glare fraction, and short-edge pixels are chosen on a tuning slice and frozen before the golden slice is scored. The measures that matter are false enhance on frames where a pen stroke was lost, false reject on frames a clerk would have accepted, and duplicate collapse inside bursts. This page does not publish those rates. A number measured on another fleet's phones would be fiction. When a pipeline version changes, the same golden set is rerun and the disposition differences are reviewed by a person before the new version is allowed to reject live uploads. A model or a rule that improves average sharpness while eating light-blue signatures fails the set even if a demo looks cleaner.

Illustrative slices for a cab-photo golden set. The carrier supplies the images and the labels. No performance rate is claimed.
Slice What the labeler checks Failure the gate should prefer
Crumple Handwriting that crosses a crease is still legible after any enhance Reject rather than a broken line that looks like a different digit
Glare and night noise Clipped regions and grain are not scored as sharp text Reject rather than a confident read of a washed-out amount
Thumb and cut-off corners No pixels were invented along the occluded edge Reject and retake
Thermal fade Faint printed lines survive in the color archive Withhold binarization if the binary copy drops the line
Near-duplicate burst One work item exists for the burst Collapse on hash, keep the better frame's score visible

What this front end must not do

The preprocessor does not complete a document. It does not guess a covered PRO, redraw a signature, remove a stamp, or raise the contrast of an amount until a new digit appears. Those actions would make the file look more billable while destroying the evidence of what the driver photographed. When the pixels are insufficient, the honest output is a reject and a retake. When the pixels are sufficient, the honest output is a rectified image, the original hash, and a score. Teams that need the next step should read the BOL and POD matching architecture and keep that step behind this gate. Strong Tower Consulting can review a capture flow against that split. Call 763-244-1373 or use the assessment form. The review is advisory and uses images the carrier is allowed to share.

Frequently asked questions

These answers keep the front end in its lane. They are the questions imaging and billing leads ask when a mobile capture project starts to absorb invoicing scope. The front end still ends at a rectified image and a score.

Illustrative thresholds in the answers are the same kind of examples as the tables. A fleet measures its own phones and its own paper. A score on a screen is not a disposition until a person or a written rule says so, and a written rule that reconstructs missing ink is not a rule this architecture allows.

Does this page extract BOL fields or post an invoice?

No. This page stops at a rectified image and a quality score. Field matching, proof of delivery rules, and billing live on the companion logistics computer vision architecture page. A front-end score is not a posted invoice.

Should a thumb covering the page be painted out?

No. Occlusion is a reject. The pipeline must not reconstruct hidden text, stamps, or amounts. The driver retakes the photo so the original ink is in the frame.

Why keep the color image if a black and white copy looks cleaner?

Binarization is an OCR convenience copy. The archive is the rectified color or grayscale image. A black and white copy can drop a light pen stroke, and the original pixels are what a later dispute needs.

What belongs in a golden set of cab photos?

Real in-cab photos the carrier has a right to retain, labeled by a person as reject, enhance, or accept, and stratified across crumple, glare, thumb, skew, thermal fade, and night noise. This page does not publish a score for that set.

Talk to an architect

Gate cab photos before a reader invents a character.

Strong Tower Consulting provides independent systems architecture, feasibility audits, and engineering roadmaps for motor carriers and freight brokers. Contact our advisory team or call 763-244-1373 to discuss your operational data and evaluate practical implementation paths for your fleet.

Published October 23, 2026 by Strong Tower Consulting, LLC. Founded 2008 in Minnesota by Scott Elliott.