如何在rgb图像上应用频域滤波器

时间:2017-01-13 09:14:47

标签: matlab image-processing rgb image-editing image-effects

如链接https://www.mathworks.com/matlabcentral/answers/uploaded_files/40966/salt_and_pepper_noise_removal_color.m中所述 应用2D滤波器可以通过在空间域中应用rgb图像的每个通道来完成。如下所示:

% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);

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

如果在频域的情况下将滤镜应用于rgb图像?

1 个答案:

答案 0 :(得分:0)

定义采样频率; 定义截止频率;

创建过滤器 - 示例butterworth

fc = 1;
fs = 10;
[b,a] = butter(6,fc/(fs/2));

对每个频道应用过滤器

dataOut = filter(b,a,double((rgbImage(:,:,1))));