-
大小: 1.65MB文件類(lèi)型: .rar金幣: 2下載: 0 次發(fā)布日期: 2023-10-26
- 語(yǔ)言: Matlab
- 標(biāo)簽:
資源簡(jiǎn)介
資源包含聯(lián)合雙邊濾波算法的matlab版代碼
資源包含聯(lián)合雙邊濾波算法的matlab版代碼

代碼片段和文件信息
function?img_out?=?bfilter2(image1?image2?n?sigma1?sigma2)
%bfilter2?function:?perfrom?two?dimensional?bilateral?gaussian?filtering.
%The?standard?deviations?of?the?bilateral?filter?are?given?by?sigma1?and
%sigma2?where?the?standard?deviation?of?spatial-domain?is?given?by?sigma1
%?and?the?standard?deviation?intensity-domain?is?given?by?sigma2.
%This?function?presents?both?bilateral?filter?and?joint-bilateral?filter.
%If?you?use?the?same?image?as?image1?and?image2?it?is?the?normal?bilateral
%filter;?however?if?you?use?different?images?in?image1?and?image2?you?can
%use?it?as?joint-bilateral?filter?where?the?intensity-domain?(range?weight)
%calculations?are?performed?using?image2?and?the?spatial-domain?(space?weight)
%calculations?are?performed?using?image1.
%Usage:
%???%Example1:?normal?bilateral?filter?using?5x5?kernel?spatial-sigma=6?and
%???%intensity-sigma=?0.25:
%???image=bfilter2(I1I151.20.25);
%???%Example2:?joint-bilateral?filter?using?5x5?kernel?spatial-sigma=1.2
%???%and?range-sigma=?0.25?the?spatial-domain?calculations?are?performed
%???%using?image?(I1)?and?the?intensity-domain?calulcations?(range?weight)
%???%are?performed?using?image?(I2):
%???image=bfilter2(I1I251.20.25);
%???%Example3:?use?the?default?values?for?n?sigma1?and?sigma2
%???image=bfilter2(I1);
%Input:
%???-image1:?the?spatial-domain?image
%???-image2:?the?intensity-domain?(range?weight)?image?(use?the?same?image
%???for?the?normal?bilateral?filter.?Use?different?images?for?joint-bilateral
%???filter.
%???(default?use?the?same?image;?i.e.?image2=image1)
%???-n:?kernel?(window)?size?[nxn]?should?be?odd?number?(default=5)
%???-sigma1:?the?standard?deviation?of?spatial-domain?(default=1.2)
%???sigma2:?the?standard?deviation?of?intensity-domain?(default=0.25)
%Author:?Mahmoud?Afifi?York?University.?
%argument‘s?check
%補(bǔ)充:輸出圖像為歸一化后double類(lèi)型圖像
if?nargin<1
????error(‘Too?few?input?arguments‘);
elseif?nargin<2
????image2=image1;
????n=5;
????sigma1=1.2;
????sigma2=0.25;
elseif?nargin<3
????n=5;
????sigma1=1.2;
????sigma2=0.25;
elseif?nargin<4
????sigma1=1.2;
????sigma2=0.25;
elseif?nargin<5
????sigma2=0.25;
end
%kernel?size?check
if?mod(n2)==0
????error(‘Please?use?odd?number?for?kernel?size‘);
end
%dimensionality?check
if?size(image11)~=size(image21)?||?size(image12)~=size(image22)?||?...
????????size(image13)~=size(image23)
????error(‘Both?images?should?have?the?same?dimensions?and?number?of?color?channels‘);
end
display(‘processing...‘);
w=floor(n/2);
%?spatial-domain?weights.
[XY]?=?meshgrid(-w:w-w:w);
gs?=?exp(-(X.^2+Y.^2)/(2*sigma1^2));
%normalize?images
if?isa(image1‘uint8‘)==1
????image1=double(image1)/255;
end
if?isa(image2‘uint8‘)==1
????image2=double(image2)/255;
end
%intialize?img_out
img_out=zeros(size(image11)size(image12)size(image13));
%padd?both?iamges
image1=padarray(image1[w?w]‘replicate‘‘both‘);
image2=padarray(imag
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件???????1518??2017-04-06?22:18??license.txt
?????文件???????3826??2017-11-10?11:14??Joint?Bilateral?filter\bfilter2.m
?????文件?????300166??2017-04-07?09:43??Joint?Bilateral?filter\demo.jpg
?????文件????????487??2017-04-07?10:08??Joint?Bilateral?filter\Demo.m
?????文件?????636620??2017-04-07?09:15??Joint?Bilateral?filter\image1.jpg
?????文件?????647883??2017-04-07?10:08??Joint?Bilateral?filter\image2.jpg
?????文件???????1761??2017-04-07?10:12??Joint?Bilateral?filter\ReadMe.txt
?????文件??????81167??2017-04-07?10:10??Joint?Bilateral?filter\result1.jpg
?????文件?????101877??2017-04-07?10:13??Joint?Bilateral?filter\result2.jpg
?????目錄??????????0??2017-11-10?11:15??Joint?Bilateral?filter
-----------?---------??----------?-----??----
??????????????1775305????????????????????10
評(píng)論
共有 條評(píng)論