Résumé
Index

2026

Foggy Lane

A fog-removal and lane-detection computer vision pipeline with IoU scoring against ground truth, deployed as a Streamlit web app.


Stack

PythonOpenCVNumPyStreamlit


Problem

Lane detection runs on edges, and fog is the thing that removes them. Canny on a hazed frame finds very little, so the interesting work happens before the detector ever runs.

Approach

Dehazing uses the Dark Channel Prior. Take the per-pixel minimum across colour channels, erode it, and read atmospheric light off the brightest pixels of that dark channel. Transmission comes out as t = 1 - omega * (dark / max(A)).

The paper fixes omega at 0.95. I made it a function of the image instead. dynamic_omega measures the mean dark-channel intensity and lowers the strength when the frame is already fairly clear, so a lightly hazed photograph does not get scrubbed into something flat. Refining the transmission map with a bilateral filter rather than soft matting keeps the edges and costs a fraction of the time.

Detection is Canny at 50/150 followed by a probabilistic Hough transform. Lines get sorted into left and right by the sign of their slope, and anything flatter than 0.1 is discarded as horizon or road marking rather than lane.

Accuracy is measured, not eyeballed. Upload a ground-truth polygon as JSON and calculate_iou rasterises the detected lane against it, scores left and right separately, then averages the two. Images over 500 KB get downscaled to 640x360 first, which roughly halves processing time on a phone photo.

Results

Six commits across two days in April 2026, which makes it the oldest of the three and the smallest. It runs as a Streamlit app on uploaded stills, one image at a time, with every intermediate stage viewable so the pipeline can be inspected rather than trusted.

It is also where I learned to measure the middle of a pipeline instead of its ends, which is a habit I have carried into everything since.