PIXELBANKv9.1.0
Menu

Implement a function to normalize image pixel values to the range [0, 1]. Normalization is a crucial preprocessing step in Computer Vision that scales the intensity values of an image to a common range, which helps in reducing the impact of illumination changes and improving the robustness of subsequent processing tasks. The normalization process involves shifting and scaling the original pixel values II using the minimum IminI_{min} and maximum ImaxI_{max} values in the image. Here are the steps to achieve this:

  1. Find the minimum and maximum pixel values in the image.
  2. Apply the normalization formula to each pixel value. The key formula for normalization is Inorm=Iβˆ’IminImaxβˆ’IminI_{norm} = \frac{I - I_{min}}{I_{max} - I_{min}} This technique is widely used in image processing pipelines.

Example:

Input:
normalize([[0, 128, 255]])
Output:
[[0.0, 0.502, 1.0]]
Reasoning:

(128-0)/(255-0) β‰ˆ 0.502

Constraints:

  • Input is a 2D grayscale image
  • If all pixels are identical, return array of 0.0 values
  • Return values rounded to 4 decimal places
solution.py

Test Results

0/0
Run code to see test results.