# A Multi-Step Image Pre-Enhancement Strategy for a Fish Feeding Behavior Analysis Using Efficientnet
## 2 Methodology
### Multi-Step Image Pre-Enhancement Strategy
#### 2.3.1 Multi-Scale Retinex with Color Restoration (MSRCR)  
In response to the challenges posed by lighting conditions on the fidelity of images capturing piscine feeding behaviors, particularly the pronounced problem of specular reflections on water surfaces, this study advocates the employment of the Multi-Scale Retinex with Color Restoration (MSRCR) algorithm as a remedial measure. The MSRCR algorithm facilitates the amelioration of water surface reflection issues by executing dynamic range compression, augmenting edge definition, and reinstating authentic coloration. Through these mechanisms, MSRCR significantly diminishes the discrepancies induced by uneven luminance, thereby ensuring the preservation of image consistency and verisimilitude across a spectrum of lighting conditions.  
The MSRCR algorithm processes images by combining filters of multiple scales (or sizes) to better address variations in illumination across different scales. The algorithm includes the following steps:  
1. Multi-Scale Decomposition: The original image undergoes decomposition into multiple scales, typically facilitated by Gaussian filters. Each scale is associated with a  
Figure 4: Results of all steps of multi-step image pre-enhancement strategy.  
Gaussian filter of distinct size, designed to capture illumination details pertinent to that specific scale.
2. Single-Scale Retinex (SSR) Processing: The Retinex algorithm is individually applied to each scale. This phase involves the computation of the logarithmic domain discrepancy between the original image and its filtered counterpart, effectively highlighting the luminance contrast while mitigating illumination inconsistencies.
3. Combination of Processed Results: The SSR results from all scales are combined through a simple arithmetic mean to form the final MSRCR output.
4. Color Restoration: Given that MSRCR processing may inadvertently alter the color balance of an image, a color restoration function is implemented to preserve the authenticity of the original hues. This ensures that the resultant image maintains a natural appearance, notwithstanding the algorithmic modifications to its luminance and contrast.  
The formula for MSRCR can be expressed as follows:  
\[R(x,y)=\sum_{i=1}^{N}w_{i}\cdot\log\left(\frac{I(x,y)}{F_{i}(x,y)}\right) \tag{1}\]  
In Equation (1), \(R(x,y)\) represents the luminance at pixel point \((x,y)\) in the Retinex output image, \(I(x,y)\) denotes the luminance of the corresponding pixel in the original image, \(F_{i}(x,y)\) refers to the filtered image at the \(i\)-th scale, \(w_{i}\) is the weight corresponding to that scale, and \(N\) signifies the total number of scales.  
The MSRCR algorithm is particularly suited for images captured under uneven lighting conditions, such as scenarios where shadowed areas are overly dark or illuminated regions are excessively bright. By adjusting the local contrast of the image, MSRCR is capable of rendering the details in these areas more visible and discernible. Furthermore, this algorithm excels in maintaining or enhancing the natural colors of the image, resulting in colors that appear more vivid and authentic.