Remoção de ruído da imagem rgb MATLAB

Estou tentando remover o ruído de uma imagem RGB já ruidosa. Eu já vi alguns exemplos em que o ruído de sal e pimenta é adicionado a uma imagem limpa e removido novamente como exemplo, mas estou lendo uma imagem já barulhenta, se isso faz sentido. Por algum motivo, este código não está fazendo alterações na imagem original. Nenhum ruído foi removido. Qualquer ajuda seria apreciada

p = imread("train.jpg");

redChannel = p(:, :, 1);
greenChannel = p(:, :, 2);
blueChannel = p(:, :, 3);

% Median Filter the channels:
redMF = medfilt2(redChannel, [3 3]);
greenMF = medfilt2(greenChannel, [3 3]);
blueMF = medfilt2(blueChannel, [3 3]);

% Find the noise in the red.
noiseImage = (redChannel == 0 | redChannel == 255);
% Get rid of the noise in the red by replacing with median.
noiseFreeRed = redChannel;
noiseFreeRed(noiseImage) = redMF(noiseImage);
% Find the noise in the green.
noiseImage = (greenChannel == 0 | greenChannel == 255);
% Get rid of the noise in the green by replacing with median.
noiseFreeGreen = greenChannel;
noiseFreeGreen(noiseImage) = greenMF(noiseImage);
% Find the noise in the blue.
noiseImage = (blueChannel == 0 | blueChannel == 255);
% Get rid of the noise in the blue by replacing with median.
noiseFreeBlue = blueChannel;
noiseFreeBlue(noiseImage) = blueMF(noiseImage);
% Reconstruct the noise free RGB image
rgbFixed = cat(3, noiseFreeRed, noiseFreeGreen, noiseFreeBlue);

figure, imshow(rgbFixed);

questionAnswers(1)

yourAnswerToTheQuestion