Bilinear Image Resizing

Core Vision Operations DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding Bilinear Interpolation for Image Resizing, Source-to-Destination Mapping, Floating Point Coordinate Clipping, Weighted Linear Combination, Boundary Condition Handling, Normalized Coordinate Space, Linear Algebra, Digital Image Processing, Spatial Transformation, Signal Processing, Numerical Analysis, Coordinate Systems, Sampling Theory, Interpolation Kernels, Pixel Grid Geometry, Aliasing Artifacts.

Implement a function bilinear resize(image, new h, new w) that takes a 2D grayscale image (represented as a list of lists) and resizes it to the target dimensions using bilinear interpolation. Assume the image corners are aligned.