✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
⛄ 内容介绍
由于人类视觉系统的复杂性以及随着数字图像处理技术的快速发展,对传统的图像处理和计算机视觉任务提出新的要求和挑战,尤其低层次图像去噪和图像融合问题.外部噪声的干扰,或多传感器获取图像,导致图像的信息不够全面或可靠,从而降低了图像质量,也制约着后续图像处理任务的执行.图像去噪的核心问题是如何在高效去除噪声的同时,保留图像边缘,轮廓和纹理等细节结构信息.双边滤波作为图像去噪和融合的一种重要手段,它时间复杂度低,且在去噪的同时和能很好地保持边缘信息.
⛄ 部分代码
% RUNDEMO Illustrates the use of BFILTER2 and CARTOON.
% This demo shows typical usage for the bilateral
% filter implemented by BFILTER2. The application
% of bilateral filtering to image abstraction is
% demonstrated by the CARTOON function.
%
% Load test images.
% Note: Must be double precision in the interval [0,1].
img1 = double(imread('einstein.jpg'))/255;
img2 = double(imread('mandrill.jpg'))/255;
img3 = double(imread('academy.jpg'))/255;
% Introduce AWGN into test images.
% Note: This will show the benefit of bilateral filtering.
img1 = img1+0.03*randn(size(img1));
img2 = img2+0.03*randn(size(img2));
img1(img1<0) = 0; img1(img1>1) = 1;
img2(img2<0) = 0; img2(img2>1) = 1;
% Set bilateral filter parameters.
w = 5; % bilateral filter half-width
sigma = [3 0.1]; % bilateral filter standard deviations
% Apply bilateral filter to each image.
bflt_img1 = bfilter2(img1,w,sigma);
bflt_img2 = bfilter2(img2,w,sigma);
% Display grayscale input image and filtered output.
figure(1); clf;
set(gcf,'Name','Grayscale Bilateral Filtering Results');
subplot(1,2,1); imagesc(img1);
axis image; colormap gray;
title('Input Image');
subplot(1,2,2); imagesc(bflt_img1);
axis image; colormap gray;
title('Result of Bilateral Filtering');
% Display color input image and filtered output.
figure(2); clf;
set(gcf,'Name','Color Bilateral Filtering Results');
subplot(1,2,1); imagesc(img2);
axis image; colormap gray;
title('Input Image');
subplot(1,2,2); imagesc(bflt_img2);
axis image; title('Result of Bilateral Filtering');
drawnow;
% Apply bilateral filter for a "cartoon" effect.
cartoon_img3 = cartoon(img3);
% Display color input image and abstracted output.
figure(3); clf;
set(gcf,'Name','Image Abstraction Input');
imagesc(img3); axis image;
title('Input Image');
figure(4); clf;
set(gcf,'Name','Result of Image Abstraction');
imagesc(cartoon_img3); axis image;
title('Abstracted Image');
⛄ 运行结果
⛄ 参考文献
[1]王晓红, 王禹琛. 基于双边滤波的自适应彩色图像去噪研究[J]. 包装工程, 2017, 38(15):5.
[2]王惠琴, 吕佳芸, 张伟. 基于双边滤波-BM3D算法的GPR图像去噪[J]. 兰州理工大学学报, 2022(048-001).