快速双边滤波源码程序 - matlab算法设计 - 谷速源码
下载频道> 资源分类> matlab源码> 算法设计> 快速双边滤波源码程序

标题:快速双边滤波源码程序
分享到:

所属分类: 算法设计 资源类型: 文件大小: 155.98 KB 上传时间: 2016-01-24 22:47:46 下载次数: 8 资源积分:1分 提 供 者: matlab源码 快速双边滤波源码程序
内容:
快速双边滤波源码程序,程序员在编程的过程中可以参考学习使用,希望对IT程序员有用,此源码程序简单易懂、方便阅读,有很好的学习价值!
部分代码如下:
% Fast Bilateral Filter Using Raised Cosines
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  inImg        :  grayscale image
%  sigma1      : width of spatial Gaussian
%  sigma2      : width of range Gaussian
%  [-w, w]^2  : domain of spatial Gaussian
%  tol             : truncation error
%
%  Author:    Kunal N. Chaudhury.
%  Date:        March 1, 2012.
%  Modified:  June 21, 2014.
%
%  References:
%  [1] K.N. Chaudhury, D. Sage, and M. Unser, "Fast O(1) bilateral
%  filtering using trigonometric range kernels," IEEE Trans. Image Proc.,
%  vol. 20, no. 11, 2011.
%
% [2] K.N. Chaudhury, "Acceleration of the shiftable O(1) algorithm for
% bilateral filtering and non-local means,"  IEEE Transactions on Image Proc., 
% vol. 22, no. 4, 2013.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
% load test image
clc, clear all, close all force;
Img    =  double( imread('./images/ckb.jpg') );
[m, n] = size(Img);
 
% create noisy image (additive Gaussian noise)
sigma  =  20;
inImg  =  Img + sigma * randn(m, n);
 
% filter parameters
sigma1 = 4;
sigma2 = 30;
tol        = 0.01;
 
% Set window for spatial Gaussian
w  = 6*sigma1;
if (mod(w,2) == 0)
    w  = w+1;
end
 
% call bilateral filter
tic;
[outImg, param] =  shiftableBF(inImg, sigma1, sigma2, w, tol);
toc;
 
% plot results
T  = param.T;
N  = param.N;
M  = param.M;
gamma  =  1 / (sqrt(N) * sigma2);
twoN   =  2^N;
 
warning('off'); %#ok<WNOFF>
 
s  = linspace(-T, T, 200);
g  = exp( -s.^2 / (2 * sigma2 *sigma2) );
gApprox  = cos(gamma * s).^N;
if M ==  0
    gTrunc = gApprox;
else
    gTrunc = zeros( 1, length(s) );
    for k = M : N - M
        gTrunc = gTrunc + (nchoosek(N, k) / twoN) * ...
            cos( (2*k - N) * gamma * s  );
    end
end
 
figure('Units','normalized','Position',[0 0.5 1 0.5]);
plot(s, g, 'b');
hold on,
plot(s, gApprox, 'm'),
hold on,
plot(s, gTrunc, 'r');
axis('tight'), grid('on'),
legend('Gassian','Raised cosine','Truncated raised cosine','FontSize', 10);
title('Comparison of the range kernels', 'FontSize', 10),
 
peak  = 255;
PSNR0 = 10 * log10(m * n * peak^2 / sum(sum( (inImg - Img).^2)) );
PSNR1 = 10 * log10(m * n * peak^2 / sum(sum((outImg - Img).^2)) );
 
figure('Units','normalized','Position',[0 0.5 1 0.5]);
colormap gray,
subplot(1,3,1), imshow(uint8(Img)),
title('Original', 'FontSize', 10), axis('image', 'off');
subplot(1,3,2), imshow(uint8(inImg)),
title([ 'Noisy, ', num2str(PSNR0, '%.2f'), 'dB'] , 'FontSize', 10),
axis('image', 'off');
subplot(1,3,3), imshow(uint8(outImg)),
title([ 'Filtered, ', num2str(PSNR1, '%.2f'), 'dB'] , 'FontSize', 10),
axis('image', 'off');
 
 
 
 
 

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

快速双边滤波源码程序/
快速双边滤波源码程序/images/
快速双边滤波源码程序/.DS_Store
快速双边滤波源码程序/demo.m
快速双边滤波源码程序/images/.DS_Store
快速双边滤波源码程序/images/barbara.jpg
快速双边滤波源码程序/images/ckb.jpg
快速双边滤波源码程序/maxFilter.m
快速双边滤波源码程序/readme.txt
快速双边滤波源码程序/screenshot.jpg
快速双边滤波源码程序/shiftableBF.m
快速双边滤波源码程序/shiftable_jointBF.m

关键词: 双边 源码 程序

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved