资源简介
双边滤波器论文“Bilateral filtering for gray and color images”代码复现及其改进代码 matlab代码
代码片段和文件信息
% BFILTER2 Two dimensional bilateral filtering.
% This function implements 2-D bilateral filtering using B = bfilter2(AWSIGMA) performs 2-D bilateral filtering
% for the grayscale A. A should be a double precision matrix of size NxMx1 or NxMx3 (i.e. grayscale images
% respectively) with normalized values in the closed interval [01]. The half-size of the Gaussian bilateral
% filter window is defined by W. The standard deviations of the bilateral filter are given by SIGMA
% where the spatial-domain standard deviation is given by SIGMA(1) and the intensity-domain standard deviation is
% given by SIGMA(2).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pre-process input and select appropriate filter.
function B = bfilter2(Awsigma)
% Verify that the input image exists and is valid.
if ~exist(‘A‘‘var‘) || isempty(A)
error(‘Input image A is undefined or invalid.‘);
end
if ~isfloat(A) || ~sum([13] == size(A3)) || ...
min(A(:)) < 0 || max(A(:)) > 1
error([‘Input image A must be a double precision ‘...
‘matrix of size NxMx1 or NxMx3 on the closed ‘...
‘interval [01].‘]);
end
% Verify bilateral filter window size.
if ~exist(‘w‘‘var‘) || isempty(w) || ...
numel(w) ~= 1 || w < 1
w = 5;
end
w = ceil(w);
% Verify bilateral filter standard deviations.
if ~exist(‘sigma‘‘var‘) || isempty(sigma) || ...
numel(sigma) ~= 2 || sigma(1) <= 0 || sigma(2) <= 0
sigma = [3 0.1];
end
% Apply either grayscale or color bilateral filtering.
if size(A3) == 1
B = bfltGray(Awsigma(1)sigma(2));
else
B = bfltColor(Awsigma(1)sigma(2));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implements bilateral filtering for grayscale images.
function B = bfltGray(Awsigma_dsigma_r)
% Pre-compute Gaussian distance weights.
[XY] = meshgrid(-w:w-w:w);
G = exp(-(X.^2+Y.^2)/(2*sigma_d^2));
% Create waitbar.
h = waitbar(0‘Applying bilateral filter...‘);
set(h‘Name‘‘Bilateral Filter Progress‘);
% Apply bilateral filter.
dim = size(A);
B = zeros(dim);
for i = 1:dim(1)
for j = 1:dim(2)
% Extract local region.
iMin = max(i-w1);
iMax = min(i+wdim(1));
jMin = max(j-w1);
jMax = min(j+wdim(2));
I = A(iMin:iMaxjMin:jMax);
% Compute Gaussian intensity weights.
H = exp(-(I-A(ij)).^2/(2*sigma_r^2));
% Calculate bilateral filter response.
F = H.*G((iMin:iMax)-i+w+1(jMin:jMax)-j+w+1);
B(ij) = sum(F(:).*I(:))/sum(F(:));
end
waitbar(i/dim(1));
end
% Close waitbar.
close(h);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10328 2015-11-07 18:25 79419116Bilateral-Filtering-advanced\Bilateral Filtering\475.tif
文件 2733 2015-11-28 18:02 79419116Bilateral-Filtering-advanced\Bilateral Filtering\bfilter2.m
文件 42447 1997-04-29 01:19 79419116Bilateral-Filtering-advanced\Bilateral Filtering\einstein.jpg
文件 835 2018-01-09 16:45 79419116Bilateral-Filtering-advanced\Bilateral Filtering\run.m
..A.SH. 17920 2015-11-30 09:31 79419116Bilateral-Filtering-advanced\Bilateral Filtering\Thumbs.db
文件 10328 2015-11-07 18:25 79419116Bilateral-Filtering-advanced\Bilateral Filtering advanced\475.tif
文件 42447 1997-04-29 01:19 79419116Bilateral-Filtering-advanced\Bilateral Filtering advanced\einstein.jpg
文件 3162 2015-11-28 18:21 79419116Bilateral-Filtering-advanced\Bilateral Filtering advanced\jbfilter2.m
文件 841 2018-01-09 16:47 79419116Bilateral-Filtering-advanced\Bilateral Filtering advanced\run1.m
..A.SH. 14336 2015-11-28 16:50 79419116Bilateral-Filtering-advanced\Bilateral Filtering advanced\Thumbs.db
目录 0 2017-02-07 14:02 79419116Bilateral-Filtering-advanced\Bilateral Filtering
目录 0 2018-01-23 20:56 79419116Bilateral-Filtering-advanced\Bilateral Filtering advanced
目录 0 2018-01-09 16:39 79419116Bilateral-Filtering-advanced
----------- --------- ---------- ----- ----
145377 13
- 上一篇:带约束的蚁群算法模型解决TSP问题MATLAB
- 下一篇:LOF算法MATLAB实现
相关资源
- tophat变换matlab代码
- sac文件读取函数matlab代码
- 分水岭算法分割苹果(matlab代码实现
- 图像相似度量Matlab代码
- 《射频电路设计:理论与应用》第2版
- 图像压缩编码算法EZW算法的MATLAB代码
- matlab代码,可将三角网格网格转换成
- 分类器设计之线性分类器和线性SVM(
- 雷达线性调频信号的模糊函数Matlab代
- 特征提取 csp matlab代码
- LMS算法及归一化LMS算法的MATLAB代码
- 均匀球体与长方体重力异常正演模拟
- 小波降噪软硬阈值改进阈值matlab代码
- 小波神经网络MATLAB代码.zip
- 差分进化算法的Matlab代码,可运行
- 一维激波管问题upwind格式matlab代码
- 肤色模型人脸识别matlab代码
- 多元回归的交叉验证程序 可供做预测
- 小波去噪matlab代码
- 蚁群算法求解最短路径问题MATLAB代码
- RLS语音信号去噪matlab代码
- 图像处理/图像分割实验/prewitt/robert
- 基于图像处理的汽车牌照识别系统m
- 弹道图绘制-matlab代码
- ID3算法 matlab代码实现
- 矩形贴片天线Matlab仿真
- MATLAB代码,用于快速平滑滤波
- MATLAB代码,用于分峰拟合
- 碎纸片拼接问题所有的matlab代码
- 计算视频质量BDBR 和BD-PSNR的matlab代码
评论
共有 条评论