PIXELBANKv8.2.1
Menu

Maximum Brightness Window

Problem Statement

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).

Applications

  • Feature detection (finding local maxima)
  • Morphological dilation
  • Finding brightest regions for exposure adjustment

Constraints

  • 1len(pixels)100001 \leq len(pixels) \leq 10000
  • 1klen(pixels)1 \leq k \leq len(pixels)
  • 0pixels[i]2550 \leq pixels[i] \leq 255

Example:

Input:
pixels = [1, 3, 2, 5, 4, 1, 3], k = 3
Output:
[3, 5, 5, 5, 4]
Reasoning:

Windows: [1,3,2]→3, [3,2,5]→5, [2,5,4]→5, [5,4,1]→5, [4,1,3]→4

Editor

Test Results

0/0
Run code to see test results.