LPF图像处理

2022-05-07

以下示例是关于Whatever中包含LPF图像处理用法的示例代码,想了解LPF图像处理的具体用法?LPF图像处理怎么用?LPF图像处理使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。

[英]:LPF Image Processing源码类型:Whatever
% Low Pass Filter (Smoothing) MATLAB


% Create a 3*3 Averaging LPF
f_average = fspecial('average', 3);


% Read in the original RGB image
im = imread("%FULLPATH%/filename.pictureformat");

% Apply the LPF to the RGB image Zero Padding
im_average_zero = imfilter(im, f_average);

% Apply the LPF to the RGB image Border Replication
im_average_rep = imfilter(im, f_average, 'replicate');


% Convert the RGB image into grayscale
im_gray = rgb2gray(im);

% Apply the LPF to the grayscale image Zero Padding
im_gray_average_zero = imfilter(im_gray, f_average);

% Apply the LPF to the RGB image Border Replication
im_gray_average_rep = imfilter(im_gray, f_average, 'replicate');


% Show the images
subplot(3,2,1), imshow(im), title('Original RGB image');
subplot(3,2,3), imshow(im_average_zero), title('Smoothed RGB image with Zero Padding');
subplot(3,2,5), imshow(im_average_rep), title('Smoothed RGB image with Border Replication');
subplot(3,2,2), imshow(im_gray), title('Original Grayscale image');
subplot(3,2,4), imshow(im_gray_average_zero), title('Smoothed Grayscale image with Zero Padding');
subplot(3,2,6), imshow(im_gray_average_rep), title('Smoothed Grayscale image with Border Replication');

本文地址:https://www.itbaoku.cn/snippets/785354.html