📘
Brightness Adjustment
EasyImage Processing
Implement a point operator to adjust the brightness of an image by modifying the intensity of each pixel. This task involves understanding how to apply a simple transformation to every pixel in an image.
The concept of brightness adjustment is fundamental in image processing, as it allows for the enhancement or correction of images based on their lighting conditions. The process involves adding a constant value to each pixel's intensity, which can be represented mathematically.
- Start with the input image Iin(x,y), where (x,y) represents the coordinates of a pixel.
- Add a constant β to the intensity of each pixel. The resulting output image Iout(x,y) is calculated by applying this transformation and ensuring the values stay within the valid range.
This technique is widely used in photography editing software.
Example:
Input:
adjust_brightness([[100, 200]], 50)
Output:
[[150, 250]]
Reasoning:
- The input image is
[[100, 200]]and the brightness offset is β=50. - For each pixel, add β: 100+50=150 and 200+50=250.
- Both results are within the valid range [0,255], so clamping does not change them.
- The final output is
[[150, 250]].
Constraints:
- beta can be positive (brighten) or negative (darken)
- Clamp output to [0, 255]
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.