Improved MSRCR Algorithm for Solar Panel Image Dehazing

In this work, I present an improved Multi-Scale Retinex with Color Restoration (MSRCR) algorithm specifically designed for dehazing images of solar panels captured under foggy conditions. Solar panels are critical components in photovoltaic power generation systems, and their real-time monitoring is essential for efficient operation and maintenance. However, fog significantly degrades image quality, reducing contrast and color fidelity, which hampers accurate inspection. My proposed method integrates bilateral filtering into the MSRCR framework to enhance contrast, preserve edge details, and restore natural colors. Through quantitative and qualitative evaluations using solar panel images from a region in Shaanxi, China, I demonstrate that the improved MSRCR algorithm outperforms traditional methods such as Bilateral Filtering, standard Retinex, and original MSRCR. The results show higher information entropy, average gradient, and spatial frequency, indicating superior image clarity and detail preservation. The improved algorithm effectively removes haze while maintaining realistic light sensitivity and color accuracy, making it suitable for practical solar panel monitoring systems.

1. Introduction

Photovoltaic (PV) power generation relies heavily on solar panels to convert sunlight into electricity. In western China, abundant solar energy resources make PV plants increasingly important. However, frequent fog and haze in these regions severely affect the visibility of monitoring cameras, resulting in blurred and low-contrast images of solar panels. Such degradation hinders timely detection of defects, dust accumulation, or shading issues, potentially reducing energy output. Therefore, robust image dehazing techniques are crucial for maintaining the reliability of PV monitoring systems.

Traditional dehazing methods, such as Dark Channel Prior (DCP), often suffer from color distortion or excessive smoothing in dense fog. Retinex-based algorithms, including Single-Scale Retinex (SSR), Multi-Scale Retinex (MSR), and MSRCR, aim to enhance contrast by separating illumination and reflectance. However, MSRCR may still produce artifacts or insufficient haze removal in challenging conditions. To address these shortcomings, I propose an improved MSRCR algorithm that incorporates bilateral filtering to better preserve edges and fine details while reducing noise. The key contributions of this work are:

  • Integration of bilateral filtering into the multi-scale processing pipeline of MSRCR to improve edge preservation and contrast adjustment.
  • Formulation of a new optimized model with adaptive parameters to balance detail enhancement and color restoration.
  • Comprehensive evaluation on real solar panel images under foggy conditions, demonstrating superior performance over existing algorithms.

The rest of this paper is organized as follows. Section 2 reviews related work on image dehazing and Retinex-based methods. Section 3 details the proposed improved MSRCR algorithm. Section 4 presents experimental results and analysis. Finally, Section 5 concludes the study.

2. Related Work

2.1 Effects of Fog on Solar Panel Images

Fog arises when water vapor condenses into small droplets suspended in the air, scattering and absorbing light. This leads to reduced contrast, faded colors, and loss of fine details in images captured by monitoring cameras. For solar panels, fog can obscure surface features such as cracks, dirt, or shading patterns that are critical for performance assessment. Figure 1 illustrates a typical foggy solar panel image; the panel’s edge details and surface texture are barely distinguishable.

Effective dehazing can restore the visual quality, enabling operators to accurately monitor the condition of solar panels. The challenge lies in dealing with spatially varying haze density and preserving natural colors without introducing artifacts.

2.2 Conventional Dehazing Methods

Most image dehazing methods rely on the atmospheric scattering model:

$$ I(x) = J(x)T(x) + A(1 – T(x)) $$

where I(x) is the observed hazy image, J(x) is the scene radiance (clear image), A is the global atmospheric light, and T(x) is the transmission map representing the portion of light not scattered. The objective is to estimate A and T, then recover J.

The Dark Channel Prior (DCP) algorithm estimates transmission by assuming that in most non‑sky patches, at least one color channel has very low intensity. Although effective, DCP often overestimates haze in bright regions and introduces color shift. Other approaches include histogram equalization, wavelet transforms, and deep learning based methods, but they may require extensive training data or high computational resources.

Retinex theory provides an alternative viewpoint by separating an image into illumination and reflectance components. SSR and MSR enhance contrast through logarithmic domain processing, while MSRCR adds a color restoration function to mitigate color distortion. However, these algorithms can amplify noise and fail to preserve edges in foggy conditions.

2.3 Limitations of Existing MSRCR

Original MSRCR is defined as:

$$ R_{MSRCR}(x,y) = \sum_{s=1}^{S} w_s \cdot R_s(x,y) $$

where R_s is the Retinex output at scale s, and w_s are weights. The color restoration step is:

$$ R_{final}(x,y) = R_{MSRCR}(x,y) + C \cdot \log(I(x,y)) $$

with C controlling color saturation. Despite its advantages, MSRCR has two major drawbacks:

  • Parameter sensitivity: Choosing appropriate scales and weights is empirical.
  • Edge blurring: The standard Gaussian filtering in scale-space tends to smooth sharp edges, reducing details in solar panel images.
  • Noise amplification: In dense haze, the log transform amplifies noise in low-intensity regions.

These limitations motivate the integration of bilateral filtering, which can smooth while preserving edges, into the MSRCR framework.

3. Proposed Improved MSRCR Algorithm

3.1 Bilateral Filtering

Bilateral filtering replaces each pixel with a weighted average of its neighbors, where the weights depend on both spatial distance and intensity difference. For an image I(x,y), the output G(x,y) is:

$$ G(x,y) = \frac{1}{W_p} \sum_{i=1}^{N} I(x+d_i, y) \cdot w_s(d_i) \cdot w_r(I(x+d_i,y) – I(x,y)) $$

where w_s is a spatial Gaussian kernel, w_r is an intensity Gaussian kernel, and W_p is the normalization factor. This filter effectively reduces noise while maintaining sharp edges, making it ideal for preserving solar panel surface details.

3.2 Modified Retinex with Bilateral Filtering

In the improved MSRCR, I replace the conventional Gaussian filtering in each Retinex scale with bilateral filtering. The single‑scale Retinex output becomes:

$$ R'(x,y) = \log(I(x,y)) – \log\left( \frac{1}{W_p} \sum_{i=1}^{N} I(x+d_i,y) \cdot w_s(d_i) \cdot w_r(I(x+d_i,y)-I(x,y)) \right) $$

Equivalently, using the bilateral filtered version G as the smoothed illumination estimate:

$$ R'(x,y) = \log\left( \frac{I(x,y)}{G(x,y)} \right) $$

For multi‑scale processing, I compute G_s at different spatial scales (different σ_s and σ_r) and combine them:

$$ R_{bilateral}(x,y) = \sum_{s=1}^{S} \beta_s \cdot \log\left( \frac{I(x,y)}{G_s(x,y)} \right) $$

where β_s are weights. Finally, the color restoration is applied:

$$ R_{improved}(x,y) = R_{bilateral}(x,y) + \alpha \cdot \log(I(x,y)) $$

where α is an adaptive parameter. To further optimize the result, I introduce two tunable parameters γ and δ into the final formula:

$$ R_{improved}(x,y) = \gamma \cdot \log\left( \frac{I(x,y)}{\left( \prod_{i=1}^{N} G(x+d_i,y) \right)^{\delta}} \right) $$

with γ controlling overall contrast and δ adjusting the degree of smoothing. These parameters are optimized via gradient descent on a small validation set to maximize a combined metric of contrast and color naturalness.

3.3 Algorithm Flowchart

The overall process consists of the following steps:

  1. Input the hazy solar panel image.
  2. For each scale (e.g., σ_s = 10, 30, 60 pixels; σ_r = 0.05, 0.1, 0.2 in normalized intensity range), apply bilateral filtering to obtain G_s.
  3. Compute R_s = log(I) – log(G_s).
  4. Weighted sum of all scales to get R_bilateral.
  5. Apply color restoration with parameter α to obtain final enhanced image.
  6. Optionally perform contrast stretching to map the dynamic range to [0,255].

This approach ensures that edge details (e.g., solar panel grid lines) are preserved while haze is reduced. The algorithm does not rely on atmospheric light estimation, thus avoiding common artifacts in D‑based methods.

4. Experiments and Results

4.1 Experimental Setup

I evaluated the proposed algorithm on a dataset of 50 solar panel images captured under foggy conditions at a photovoltaic plant in Shaanxi, China. The images have a resolution of 1920×1080 pixels. I compared the improved MSRCR with three baseline methods: Bilateral Filtering (BF) alone, standard Retinex (SSR), and original MSRCR. All algorithms were implemented in Python 3.9 using OpenCV and NumPy on a PC with Intel Core i7 CPU and 16 GB RAM.

The parameters for each method were set as follows:

  • BF: Spatial sigma = 30, intensity sigma = 0.1, kernel size = 21×21.
  • SSR: Single scale with Gaussian sigma = 30.
  • MSRCR: Scales = [10,30,60], weights = [1/3,1/3,1/3], C = 0.1.
  • Proposed: Scales = [10,30,60], σ_r = [0.05,0.1,0.2], β = [0.3,0.4,0.3], γ = 1.2, δ = 0.8, α = 0.05.

4.2 Subjective Evaluation

Figure 2 shows a sample solar panel image processed by each method. The original foggy image appears washed out with low contrast. The BF result improves contrast but loses sharpness and appears overly bright. SSR and MSRCR enhance details but introduce color distortion (e.g., purple tint on the panel surface). The proposed improved MSRCR produces a natural, well‑balanced image with clear grid lines and realistic colors, closely resembling a fog‑free scene.

4.3 Objective Evaluation Metrics

I used three quantitative metrics to evaluate dehazing performance:

  • Information Entropy (IE): Measures the amount of image information; higher values indicate richer details.
  • Average Gradient (AG): Reflects the sharpness of edges and texture; higher values suggest better clarity.
  • Spatial Frequency (SF): Quantifies the overall activity level in the image; higher values correspond to finer details.

Table 1 presents the average results over all 50 test images.

Table 1: Quantitative Comparison of Dehazing Methods
Method Information Entropy Average Gradient Spatial Frequency
Original (Foggy) 5.266 21.232 4789.659
Bilateral Filtering 6.862 45.439 10626.821
Retinex (SSR) 7.023 50.626 11243.367
MSRCR 7.221 52.325 12003.582
Improved MSRCR (Proposed) 7.630 57.406 12619.470

From Table 1, the proposed algorithm achieves the highest IE (7.630), AG (57.406), and SF (12619.470). Compared to MSRCR, the improvements are approximately 5.7% in IE, 9.7% in AG, and 5.1% in SF. This demonstrates that bilateral filtering helps retain more fine details and edge information.

4.4 Additional Analysis on Solar Panel Specifics

To further validate the effectiveness for solar panel monitoring, I examined the visibility of grid lines and busbars. The proposed method consistently rendered these features sharper than other algorithms, which is crucial for detecting microcracks or soiling. In addition, the color restoration parameter α was tuned to avoid oversaturation, preserving the blue‑grey appearance of typical polycrystalline panels.

A comparison of computational time is shown in Table 2.

Table 2: Average Processing Time per Image (1920×1080)
Method Time (seconds)
Bilateral Filtering 0.45
Retinex (SSR) 0.32
MSRCR 1.12
Improved MSRCR 1.45

Although the proposed method is slightly slower than MSRCR due to bilateral filtering, it remains suitable for near‑real‑time applications (e.g., processing one frame per 1.5 seconds). Optimizations using GPU acceleration or downsampling can further reduce time.

5. Conclusion

In this paper, I have presented an improved MSRCR algorithm for removing haze from solar panel images. By embedding bilateral filtering into the multi‑scale Retinex framework, the method enhances contrast while preserving edge details and avoiding color distortion. Experiments on real foggy solar panel images from a Shaanxi PV plant demonstrate that the proposed algorithm outperforms BF, SSR, and original MSRCR in terms of information entropy, average gradient, and spatial frequency. The resulting images exhibit more realistic colors and finer details, facilitating accurate monitoring of solar panel conditions.

Future work will focus on further reducing computational complexity to enable real‑time video processing and extending the method to handle non‑uniform haze distributions. Additionally, I plan to develop a lightweight deep‑learning based refinement module that can be integrated with the proposed algorithm to adaptively adjust parameters for varying fog densities.

In summary, the improved MSRCR algorithm provides a practical and effective solution for dehazing solar panel images, contributing to the reliable operation of photovoltaic power plants.

Scroll to Top