Loading...
In image analysis, we often need to find the brightest region of a fixed size. Given a 1D array of pixel intensities and a window size k, find the maximum value in each sliding window position.
This is equivalent to applying a max filter (dilation in morphological operations).
pixels = [1, 3, 2, 5, 4, 1, 3], k = 3
[3, 5, 5, 5, 4]
Windows: [1,3,2]→3, [3,2,5]→5, [2,5,4]→5, [5,4,1]→5, [4,1,3]→4