資源簡介
偏微分方程數字圖像處理技術matlab程序合集,代碼親測!

代碼片段和文件信息
%%%?This?program?implement?image?interpolation?by?AMLE?method.?Firstly?get
%%%?a?number?of?level?sets?from?an?input?image?by?thresholdding.?The?threshold
%%%?values?are?chosen?automatically.?Then?the?boundaries?for?each?level?set
%%%?are?extracted?the?image?data?on?the?boundaries?are?recorded.?Finally?
%%%?by?using?AMLE?extend?those?imformation?to?reconstract?a?new?image
%%%?which?will?approximate?the?original?one?quitr?well.
clear?all;
close?all;
clc;
Img?=?imread(‘lady.bmp‘);
Img=rgb2gray(Img);
figure(1);imshow(uint8(Img));
[ny?nx]?=?size(Img);
N=12;??????????????????????????%?A?presetting?parameter--Number?of?level_sets
h=imhist(Img)/(ny*nx);
D_max([1:N])=0;?????????????????
count([1:N])=0;????????????????
start=0;s=0.0;?
for?n=1:N?
???for?d=start:255?????????????
???????if?h(d+1)>0
??????????count(n)=count(n)+1;
??????????s=s+h(d+1);
??????????if?s>=double(n/N)??????????
??????????????D_max(n)=d-1;???????????
??????????????count(n)=count(n)-1;????
??????????????s=s-h(d+1);?????????????
??????????????start=d;????????????????
??????????????break;??????????????????
??????????end
???????end
???end
end
count(N)=count(N)+1;
D_max(N)=D_max(N)+1;
nn=0;
for?n=1:N
???if?count(n)>0
??????nn=nn+1;
??????D_max(nn)=D_max(n);
???end
end?
%?Now?nn?is?the?number?of?level_sets
Level_Set_Boundary=zeros([ny?nx]);??%Recode?boundares?only?for?display
Boundary_Img=zeros([ny?nx]);????????%Recode?the?gray?values?of?the?image?on?the?boundares
for?n=1:nn
????bw=zeros([ny?nx]);
????if?n==1;
????????D_min=0;
????else
????????D_min=D_max(n-1)+1;
????end
????for?i=1:ny
????????for?j=1:nx
????????????if?Img(ij)>=D_min?
???????????????bw(ij)=1;?
????????????end
????????end
????end
????
????se?=?strel(‘disk‘5);??????????%?Set?a?stracturing?elememt
????BW2?=?imopen(bwse);???????????%?Make?open?opartion?to?the?level?sets
????????
????B?=?bwboundaries(BW2);?????????%?Get?boundaries
????for?i?=?1:length(B)
????????boundary=B{i};
????????L=length(boundary);
????????for?ii=1:L
????????????xx=boundary(ii2);????????????????%?Get?positions?of?the?boundary?points
????????????yy=boundary(ii1);
????????????Level_Set_Boundary(yyxx)=1;??????%?Recode?the?positions?for?diplay?only.
????????????Boundary_Img(yyxx)=Img(yyxx);???%?Recode?the?image?data?for?extension.
????????????
????????end
????end
end
figure(2);imshow(Level_Set_Boundary);
figure(3);imshow(uint8(Boundary_Img));
Diff_Img=120+50*randn([ny?nx]);?????????????%?Randon?intialization
[nrow?ncol]=size(Diff_Img);?
delt=0.2;
%?Iteration?begin?here
for?n=1:300
????I_x?=?(Diff_Img(:[2:ncol?ncol])-Diff_Img(:[1?1:ncol-1]))/2;
????I_y?=?(Diff_Img([2:nrow?nrow]:)-Diff_Img([1?1:nrow-1]:))/2;
????I_xx?=?Diff_Img(:[2:ncol?ncol])+Diff_Img(:[1?1:ncol-1])-2*Diff_Img;
????I_yy?=?Diff_Img([2:nrow?nrow]:)+Diff_Img([1?1:nrow-1]:)-2*Diff_Img;
????I_xy?=?0.25*(Diff_Img([2:nrow?nrow][2:ncol?ncol])+Diff_Img([1?1:nrow-1][1?1:nc
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3419??2007-12-11?18:04??MATLAB_Program\AMLE_level_set_interp.m
?????文件????????848??2007-12-11?09:13??MATLAB_Program\bilinear_interpolat2.m
?????文件???????1184??2007-12-07?16:41??MATLAB_Program\biquad_interpolat.m
?????文件???????2941??2007-12-10?19:57??MATLAB_Program\Color_dirct_Diff.m
?????文件???????1259??2007-12-10?20:03??MATLAB_Program\createimage.m
?????文件???????1279??2007-12-17?07:55??MATLAB_Program\curve_linear_heat_flow.m
?????文件???????2027??2007-12-12?07:39??MATLAB_Program\C_V.m
?????文件???????3443??2007-12-10?20:01??MATLAB_Program\GAC_upwind.m
?????文件???????1152??2007-12-09?13:36??MATLAB_Program\gauss.m
?????文件???????4269??2007-12-11?18:14??MATLAB_Program\Mag_Color_Snake.m
?????文件???????3745??2007-12-09?21:28??MATLAB_Program\MCM_explicit.m
?????文件???????4522??2007-12-10?20:11??MATLAB_Program\Multil
?????文件???????1947??2007-12-09?16:48??MATLAB_Program\P_L_HE_f.m
?????文件???????2394??2007-12-10?16:29??MATLAB_Program\P_M_AOS.m
?????文件????????633??2007-12-11?18:07??MATLAB_Program\Thomas.m
?????文件???????1712??2008-03-31?16:46??MATLAB_Program\TV_resto.m
?????目錄??????????0??2013-01-11?16:33??MATLAB_Program
-----------?---------??----------?-----??----
????????????????36774????????????????????17
評論
共有 條評論