SEARCH THE LAB

What are you looking for?

SkillsReview information not provided

Removing a Fleeting Obstruction from a Photo with a Multi-Frame Median

Review information not providedAdded to the lab: 20 November 2026

Start with a concrete scenario: you want to photograph an information sign or the facade of a building, and people keep walking through the frame, or a car i…

Added to the lab
Downloads
0
Human review
Review information not provided

Start with a concrete scenario: you want to photograph an information sign or the facade of a building, and people keep walking through the frame, or a car is temporarily parked at the edge of the shot. In a single photo, the obstruction is real pixels; but if you stand still and shoot a dozen or so frames in a row, it will only appear in a few of them, at the same position. The principle is simple: take the median across multiple frames at the same coordinate, and values that appear only occasionally get pushed down by the normal values from the majority of frames.

Why not average. Averaging mixes the obstruction into the result in proportion to how many frames it appears in, leaving a semi-transparent ghost; the median is insensitive to a small number of outliers, but the price is that it cannot do anything about an anomaly present in more than half the frames. Which statistic to choose depends on what fraction of frames the obstruction appears in.

Step one: fix the camera position. Mount the phone or camera securely, turn off autofocus hunting, and lock focus, exposure and white balance. Handheld burst shooting also works, but you must align the frames first, otherwise the edges will be soft.

Step two: shoot continuously. Within the time window in which the obstruction moves, take at least seven to ten frames, with intervals as even as possible. The more frames, the more stable the median; below five frames, once the obstruction occupies two or three of them, the result will lean toward it. The total duration should be capped at the time the obstruction takes to cross the frame; shooting for too long introduces changes in lighting and crowds of passers-by.

Step three: composite pixel by pixel. Treat this set of photos as a stack, take the value at each coordinate from every frame, sort them, and pick the middle one. In image tools this is usually called a median stack or statistical stack; command-line tools that process each channel separately can produce the same result. Save the composite in a lossless format, so that another round of lossy compression does not blur the edges you just recovered.

Step four: check the seams. Zoom in on the path the obstruction travelled: if it moved slowly, the edges will show a semi-transparent smear, meaning it lingered in too many frames. In that case, shorten the interval or extend the total duration so that it appears in fewer frames at any single point.

Limitations need to be stated. This method assumes a static background: leaves, water surfaces, flags and video on screens all change between frames, and the median will smear them into mush rather than making them clearer. If the obstruction stays at a point for more than half the frames, the median cannot rescue it either. And a multi-frame median does not add detail; it only picks the more credible value out of multiple frames, so text that was already blurry will not become sharp because of it.

Two details that are easy to overlook. First, if the camera's auto white balance or auto exposure changes during the burst, the frames will have inconsistent brightness and the composite will show colour patches; locking these automatic settings before shooting is less trouble than fixing it afterwards. Second, handheld shooting requires registration before stacking, and registration error shows up in high-frequency detail; it helps to have a static hard edge in the frame as a reference; if the background's fine texture shows directional blur, registration is probably the problem.

If you just want to test the idea, you can first take three shots, quickly pass a finger once across the front of the lens, and then composite them: the area the finger passed over should be restored, and the background detail should stay unchanged. That is the entire promise this method can make — remove the occasional, keep the usual.