Problem 1: Aligning and blending photos into one panorama
- Problem
- Photos taken by rotating a camera about one point can be aligned with a homography, but two things go wrong: warped photos land at negative or out-of-frame coordinates, and pasting them on top of each other leaves visible seams where exposure and alignment differ slightly.
- What I did
- Estimate each homography by linear least squares: two equations per point pair, h33 fixed to 1, solved with np.linalg.lstsq. For the two course sets I clicked 16 pairs per photo (the minimum is 4).
- Size the output canvas by warping each photo's four corners into the base photo's frame and taking the bounding box; then map every pixel through its homography and resample onto the canvas grid with SciPy's griddata.
- Blend with feathered alpha masks: each photo's weight is its distance transform from the photo's edge, clipped at 55 px, then normalized so overlapping weights sum to 1; pixels no photo covers stay black.
- Why this approach
- Least squares over more than four pairs averages out click error instead of fitting a few bad clicks exactly. Distance-transform weights fall to zero at each photo's border, so the change from one photo to the next spreads across the overlap rather than happening at a hard edge; clipping at 55 px confines that transition to a band near each edge.
Open full-size image
Open full-size image
Open full-size image
Open full-size image




