【Basic】Illumination Correction and White Balance Adjustment for MATLAB Images
发布时间: 2024-09-15 02:57:49 阅读量: 33 订阅数: 50
illumination.rar_illumination_matlab_visible light
# 1. Fundamental Principles of Illumination Correction
Image illumination correction aims to improve the brightness and contrast of an image, making it more consistent with the effects observed by the human eye. The basic principles include:
***Adjustment of Image Brightness and Contrast:** By adjusting pixel values, the overall brightness and contrast of the image are altered to make it clearer or darker.
***Histogram Equalization:** Analyzing the image's histogram distribution and adjusting pixel values to make the histogram more uniform, thereby enhancing the contrast and detail richness of the image.
# 2. Theory and Practice of Image Illumination Correction
### 2.1 Fundamental Principles of Illumination Correction
Illumination correction aims to improve the brightness and contrast of an image, making it more suitable for human observation or further processing. The basic principles include:
**2.1.1 Adjustment of Image Brightness and Contrast**
***Brightness Adjustment:** Changing the overall brightness of the image by adjusting pixel values.
***Contrast Adjustment:** Enhancing or diminishing the difference between light and dark areas in the image by stretching or compressing the range of pixel values.
**2.1.2 Histogram Equalization**
Histogram equalization is a nonlinear image enhancement technique that adjusts the histogram distribution of the image, making the pixel distribution of different grayscale levels more uniform, thus improving the contrast and brightness of the image.
### 2.2 Implementation of Illumination Correction in MATLAB
#### 2.2.1 Common Illumination Correction Functions
MATLAB provides various illumination correction functions, including:
* `imadjust`: Adjusts the brightness and contrast of an image.
* `histeq`: Performs histogram equalization.
* `adapthisteq`: Performs adaptive histogram equalization, adjusting the histogram based on the local areas of the image.
#### 2.2.2 Practical Case: Correction of Underexposed Images
**Code Block:**
```matlab
% Read the underexposed image
image = imread('underexposed.jpg');
% Adjust brightness and contrast
adjusted_image = imadjust(image, [0.2, 0.8], []);
% Display the corrected image
figure;
subplot(1, 2, 1);
imshow(image);
title('Original Image');
subplot(1, 2, 2);
imshow(adjusted_image);
title('Corrected Image');
```
**Logical Analysis:**
* The `imread` function reads the image file.
* The `imadjust` function adjusts the brightness and contrast of the image. The first parameter specifies the pixel value range of the input image, and the second parameter specifies the output image's pixel value range.
* The `imshow` function displays the image.
**Parameter Explanation:**
* `imadjust` function:
* `[0.2, 0.8]`: The pixel value range of the input image, indicating the mapping of pixel values to the [0, 1] interval.
* `[]`: The pixel value range of the output image, indicating to maintain the same range as the input image.
# 3. Theory and Practice of Image White Balancing
### 3.1 Basic Concepts of White Balancing
#### 3.1.1 Color Temperature and White Point
Color temperature is a physical quantity that describes the color characteristics of a light source, measured in Kelvin (K). The higher the color temperature, the more the light source's color shifts towards blue; the lower the color temperature, the more the color shifts towards red.
The white point is the pixel in the image that is considered white. The color temperature of the white point determines the relative color temperature of other colors in the image.
#### 3.1.2 Color Space Transformation
A color space is a mathematical model that describes colors. Different color spaces use different coordinate systems to represent colors.
White balancing involves converting the image from one color space (e.g., RGB) to another (e.g., XYZ), so that the white point has the expected color temperature.
### 3.2 Implementation of White Balancing in MATLAB
#### 3.2.1 Common White Balancing Functions
MATLAB provides various white balancing functions, including:
0
0