Open In App

Adaptive Filtering – Local Noise Filter in MATLAB

Last Updated : 22 Nov, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

On the degraded image, which contains both the original image and noise, an adaptive filter is applied. With a predetermined mxn window region, the mean and variance are the two statistical measures on which a locally adaptive filter depends. 

Adaptive Filters:

adaptive filters are also Digital filters that change their coefficients with the intention of bringing the filter closer to its optimal state. A cost function, typically the mean square of the error signal between the adaptive filter’s output and the desired signal, serves as the optimization criterion. The mean square error (MSE) converges to its minimal value as the filter adjusts its coefficients. The coefficients have converged to a solution and the filter has been modified at this point. The desired signal, d(k), is said to be very closely matched by the filter output, y(k). The filter adjusts to the new environment by generating a new set of coefficients for the new data when the characteristics of the input data are altered, a process that is referred to as the “filter environment.”

Adaptive filter algorithm

 

Application of Adaptive Filter:

  1. System Identification: Identifying Unknown Systems Using an Adaptive Filter- Identifying an unknown system, such as the response of an unknown communications channel or the frequency response of an auditorium, to select fairly distinct applications is one common application of adaptive filters. Channel identification and echo cancellation are two additional applications.
  2. Using an Adaptive Filter to Remove Noise from an Unknown System: Noise or Interference Cancellation- In commotion crossing out, versatile channels let you eliminate clamor from a sign continuously. Noise and desired information are combined here into the desired signal, the one to be cleaned. Feed the adaptive filter a signal n'(k) that is correlated to the noise to be removed from the desired signal to get rid of the noise.
  3. Identification of an Inverse Response to an Unknown System via Inverse System-  adaptive filter becomes the inverse of the unknown system as e(k) decreases when the unknown system is placed in series with it. In order to keep the data at the summation synchronized, the procedure necessitates the addition of a delay to the desired signal d(k) path, as depicted in the figure. The system remains causal when the delay is added.
  4. A Periodic Signal’s Future Values Can Be Predicted  Through Prediction- In order to predict signals, you must make important assumptions. Assume that the signal is periodic and either steady or slowly changing over time.

Use of Adaptive Filter:

Modern digital signal processing (DSP) products use adaptive filters extensively in applications like active noise control (ANC), adaptive control systems, telephone echo cancellation, noise cancellation, communications channel equalization, and biomedical signal amplification.

Example 1:

Matlab




% MATLAB CODE for Adaptive filtering- Local Noise filter  
X = imread('GeeksforGeeks.png');
Y = rgb2gray(X);
sz = size(Y,1)*size(Y,2);
  
% Add gaussian noise with mean 0 and variance 0.010
y = imnoise(y,'gaussian',0,0.010);
figure,imshow(y); title('Image with gaussian noise');
  
y = double(y);
  
% Define the window size mxn
U = 10;
V = 10;
  
% Fill the matrix up on all sides with zeros.
Z = padarray(Y,[floor(N/2),floor(M/2)]);
  
lvar = zeros([size(y,1) size(y,2)]);
lmean = zeros([size(y,1) size(y,2)]);
temp = zeros([size(y,1) size(y,2)]);
NewImg = zeros([size(y,1) size(y,2)]);
  
for i = 1:size(Z,1)-(N-1)
    for j = 1:size(Z,2)-(M-1)
  
 temp = Z(i:i+(N-1),j:j+(M-1));
        tmp =  temp(:);
             % Determine the region's local mean and variance.        
        lmean(i,j) = mean(tmp);
        lvar(i,j) = mean(tmp.^2)-mean(tmp).^2;
          
    end
end
  
% Commotion fluctuation and normal 
% of the neighborhood change
nvar = sum(lvar(:))/sz;
  
% If noise_variance > local_variance 
% then local_variance=noise_variance
 lvar = max(lvar,nvar);     
  
% Final_Image = Y- (noise variance/
% local variance)*(Y-local_mean);
 NewImg = nvar./lvar;
 NewImg = NewImg.*(Y-lmean);
 NewImg = Y-NewImg;
  
% Convert the image to uint9 format.
 NewImg = uint9(NewImg);
figure,imshow(NewImg);title('Restored Image using Adaptive Local filter');


Output:

 

Restore image using adaptive local filter

 

Adaptive Noise Reduction:

Variable broadband noise, such as wind, rumble, and background sounds, is quickly eliminated by the Noise Reduction/Restoration > Adaptive Noise Reduction effect. You can apply this effect in the Multitrack Editor and combine it with other effects in the Effects Rack because it operates in real-time.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads