www.pudn.com > fractional-differential.rar > Enhance.m, change:2014-12-09,size:1690b


%%%图像增强实验 ,不同大小Tiansi掩膜算子对比 
close all 
clear all 
clc 
I = imread('baboon.jpg'); %fabric.png  ../image/baboon.jpg 
imshow(I); 
title('原图像'); 
I = im2double(I(:,:,1));  
w1 = fspecial('laplacian',0); 
I1 = imfilter(I,w1,'conv','replicate'); 
G1 = I-I1; 
figure,imshow(G1); 
title('Laplacian增强效果—1');   %Laplacian图像增强,未考虑对角线元素 
w2 = [1 1 1;1 -8 1;1 1 1]; 
I2 = imfilter(I,w2,'conv','replicate'); 
G2 = I-I2; 
figure,imshow(G2); 
title('Laplacian增强效果—2');   %Laplacian图像增强,考虑对角线元素 
 
%% 
%分数阶微分 
v = 0.8   % v代表分数阶微分的阶数 
a0 = 1; 
a1 = -v; 
a2 = (-v)*(-v+1)/2; 
a3 = (-v)*(-v+1)*(-v+2)/6; 
a4 = (-v)*(-v+1)*(-v+2)*(-v+3)/24; 
F1 = [a1 a1 a1 ;a1 8*a0 a1 ;a1 a1 a1]./(8-12*v+4*v*v);   % 3*3分数阶掩膜算子 
F2 = [a2 0 a2 0 a2 ;0 a1 a1 a1 0 ;a2 a1 8*a0 a1 a2 ;... 
    0 a1 a1 a1 0 ;a2 0 a2 0 a2]./(8-12*v+4*v*v);        % 5*5分数阶掩膜算子 
F3 = [a3 0 0 a3 0 0 a3 ;0 a2 0 a2 0 a2 0 ;0 0 a1 a1 a1 0 0 ;a3 a2 a1 8*a0 a1 a2 a3;... 
    0 0 a1 a1 a1 0 0 ;0 a2 0 a2 0 a2 0 ;a3 0 0 a3 0 0 a3]./(8-12*v+4*v*v);   % 7*7分数阶掩膜算子 
 
% F1 = [v/(8*v-8),v/(8*v-8),v/(8*v-8);... 
%                          v/(8*v-8),8/(8-8*v),v/(8*v-8);... 
%                          v/(8*v-8),v/(8*v-8),v/(8*v-8)]; %另一种掩膜算子 
 
% G_frac_1 = imfilter(I,F1,'conv','replicate');  
% figure,imshow(G_frac_1,[]); 
% title(['3*3分数阶掩膜算子',' 阶数',num2str(v),'阶']); 
 
G_frac_2 = imfilter(I,F2,'conv','replicate');  
figure,imshow(G_frac_2,[]); 
title(['5*5分数阶掩膜算子',' 阶数',num2str(v),'阶']); 
 
% G_frac_3 = imfilter(I,F3,'conv','replicate');  
% figure,imshow(G_frac_3,[]); 
% title(['7*7分数阶掩膜算子',' 阶数',num2str(v),'阶']);