資源簡介
基于NSCT+pcnn的圖像融合源碼,得到的融合圖像很清晰!效果不錯
代碼片段和文件信息
pfilt?=?‘9-7‘;
dfilt?=?‘pkva‘;
nlevs?=?[?1?2?34];?%元素不為零
link_arrange=5;???????
iteration_times=200;???%最大迭代次數
?
A=imread(‘tuxiang1.png‘);
B=imread(‘tuxiang2.png‘);
firing_times1=cell(15);
firing_times1{12}=cell(12);
firing_times1{13}=cell(14);
firing_times1{14}=cell(18);
firing_times1{15}=cell(116);
firing_times2=cell(15);
firing_times2{12}=cell(12);
firing_times2{13}=cell(14);
firing_times2{14}=cell(18);
firing_times2{15}=cell(116);
A=im2double(A);
y1?=?nsctdec(Anlevsdfilt?pfilt);
B=im2double(B);
y2?=?nsctdec(Bnlevsdfilt?pfilt);
%在點火脈沖圖里面計算區域均方誤差,然后根據區域均方誤差的大小選擇融和圖像
firing_times1{1}=PCNN_large_arrange(y1{1}link_arrangeiteration_times);
firing_times2{1}=PCNN_large_arrange(y2{1}link_arrangeiteration_times);
ss1=size(firing_times1{1});
figureimshow(firing_times1{1}[])
figureimshow(firing_times2{1}[])
for?i=1:ss1(1)
????for?j=1:ss1(2)
????????if(i==1||i==ss1(1)||j==1||j==ss1(2))
????????????????????if(abs(y1{1}(ij))>abs(y2{1}(ij)))
???????????????????????y{1}(ij)=y1{1}(ij);
????????????????????else
???????????????????????y{1}(ij)=y2{1}(ij);?
????????????????????end
?????????????????else
????????for?h=1:3
???????????????????????for?g=1:3???????????
??????????????????????????C(hg)=firing_times1{1}(i-2+hj-2+g);
??????????????????????????D(hg)=firing_times2{1}(i-2+hj-2+g);
??????????????????????????if(std2(D)>std2(C))
??????????????????????????????y
評論
共有 條評論