# Performance Comparison of Selected Filters in Fast Denoising of Oil Palm Hyperspectral Data
## 2 Methodology
### Approach  
In this work, one-dimensional (1D) filtering was used to filter the speckle noise that normally affects the low- and high-wavelength channels of oil palm hyperspectral data. The main idea is the fact that the intensity of a pixel at a particular location in a channel varies slowly within the channel and across the neighboring channels. Sharp changes in intensity of a particular pixel are attributed to noise and can be lowpass-filtered. For fast denoising, 1D filtering is performed across the channels and within each channel using the same filter and is chosen as the workhorse of the framework since it is fast to implement and suitable for implementing Wiener and Kalman filters. The flow of steps taken to filter noise from the hyperspectral data is shown in Figure 3.  
The first step in the process was to read the hyperspectral data and store them in a 3D array. The size of the data was limited to 500 \(\times\) 500 \(\times\) 300. From experience, it is found that only the channels that belong to the low wavelength of 350-380 nm and high wavelength of 900-1000 nm are visibly noisy. Thus, filtering was focused on these channels, and they were filtered together in two separate groups. It was observed that the noise level at both ends of the wavelength became worse as the channel wavelength decreased toward 350 nm and increased toward 1000 nm.  
Figure 3: Flow of steps in denoising the hyperspectral oil palm data.  
Figure 2: Samples of low- and high-wavelength channels.  
The second step was to identify some 50 \(\times\) 50 patches of homogeneous or uniform areas with low means and low standard deviations (stds). This step was executed offline on one of the cleaner channels automatically. Since the locations of the homogeneous areas were the same for all bands, the relative noise levels in the noisy channels were able to be estimated from those areas. However, it should be noted that the SNRs are only estimates. The means and stds of the identified patches were calculated along with the means of the channels. Using these parameters, the signal-to-noise ratios (SNRs) of the channels were estimated as follows [34]:  
\[\text{SNR}=10\ \text{log}_{10}\ (\mu^{2}/\sigma^{2})=20\ \text{log}_{10}\ (\mu/\sigma)\]  
where:  
\(\mu\) is the average intensity of the channel.  
\(\sigma\) is the average of the standard deviations of the homogeneous areas.  
The SNR estimates were compared against a threshold (Th), and channels whose SNRs fell below the Th were selected for denoising. The third step was 1D spectral filtering that exploited the strong correlations among consecutive bands. It started with collecting the intensity values of every pixel (x,y) of the noisy images and storing them in a 1D array. Note that the noisy channels of low and high wavelengths were collected and processed separately. For each pixel, the values in the array were filtered starting from the band with the lowest noise towards the band with the highest noise at the wavelength ends. Figure 4 depicts how the pixel values of the noisy bands at one location (x,y) were collected in a 1D array. The 1D spectral filtering was conducted as follows.  
Suppose that there are M noisy images and the pixel values at a location (x,y) are collected in a 1D array. Let s(m) be the array containing the pixel values of one location (x,y) from M channels, where m = 1, 2,..., M. The values are stored sequentially channel by channel. The linear Kalman filter is an algorithm that is implemented by a set of recursive equations. The successive prediction and correction equations of the Kalman filter at element \(i\) of the array, \(s(i)\), are simplified as follows [35]:  
\[\hat{x}^{-}(i)=\hat{x}(i-1) \tag{1}\]  
\[P^{-}(i)=P(i-1)+Q \tag{2}\]  
\[K(i)=\frac{P^{-}(i)}{P^{-}(i)+R} \tag{3}\]  
\[\hat{x}(i)=\hat{x}^{-}(i)+K(i)(s(i)-\hat{x}^{-}(i)) \tag{4}\]  
\[P(i)=(1-K(i))P^{-}(i)\]