This needs to be `np.arange(h+1)` and `np.arange(w+1)`.  To understand why, take the degenerate case of a 1 pixel image, and see my previous comment about `get_bounds()`.