图象加权中值滤波的MATLAB实现

图象加权中值滤波的MATLAB实现,第1张

medfilt3rar] - 这是一个有关matlab的中值滤波的程序

[enhance1rar] - 加权中值滤波,用于图像增强,只用于超声图像,对超声图像去噪有很好的效果。内还包括信噪比计算方法。

[040920108rar] - 均值滤波,加权滤波,中值滤波的MATLAB实例,用于图象及信号的处理

[200707171150342030rar] - 一种新的加权中值滤波的快速算法pdf 内有vc的实现程序 可快速实现加权中值

[1111rar] - 自适应中值滤波,对图像的椒盐噪声有很好的滤除效果,非常不错的程序

[WeightedMedianFilterAlgorithmforImageProcessingra] - 提出了一种基于相似度函数的自适应加权中值滤波算法。该方法首先通过噪声检测确定图像中的噪声点,然后 根据窗口内噪声点的个数自适应地调整滤波窗口的尺寸,并根据相似度大小,巧妙地将滤波窗口内各个像素点自适应分 组并赋予相应的权重,最后对检测出的噪声点进行加权中值滤波。计算机模拟实验结果表明:该算法既能

[3Matlabrar] - 程序代码说明 P0301:数字图像矩阵数据的显示及其傅立叶变换 P0302:二维离散余弦变换的图像压缩 P0303:采用灰度变换的方法增强图像的对比度 P0304:直方图均匀化 P0305:模拟图像受高斯白噪声和椒盐噪声的影响 P0306:采用二维中值滤波函数me

[medianfilter(matlab)rar] - 本程序是对均值滤波方法和中值滤波方法的去噪效果对比的MATLAB程序

x=imread('2_5tif');

y=uint8(x);

u1 = imnoise(y,'salt & pepper', 002);figure,imshow(uint8(u1));

[h w]=size(x);

for i=2:h-1

for j=2:w-1

y1=u1(i-1:i+1,j-1:j+1);%取3x3窗口

y1=reshape(y1,1,9);

for m=1:9

for n=m+1:9

if y1(n)>y1(m)

t=y1(n);y1(n)=y1(m);y1(m)=t;

end

end

end

u1(i,j)=y1(5);

end

end

figure,imshow(uint8(u1));

这是别人写的一个gabor滤波器的程序,你看看吧!

% GABORFILTER Bi-dimensional Gabor filter with DC component compensation

% [G,GABOUT]=GABORFILTER(I,S,F,W,P) filters the input image I with the 2D

% Gabor filter G described by the parameters S, F, W and P to create the

% output filtered image GABOUT

% This version of the 2D Gabor filter is basically a bi-dimensional

% Gaussian function centered at origin (0,0) with variance S modulated by

% a complex sinusoid with polar frequency (F,W) and phase P described by

% the following equation:

%

% G(x,y,S,F,W,P)=kGaussian(x,y,S)(Sinusoid(x,y,F,W,P)-DC(F,S,P)),

% where:

% Gaussian(x,y,S)=exp(-piS^2(x^2+y^2))

% Sinusoid(x,y,F,W,P)=exp(j(2piF(xcos(W)+ysin(W))+P)))

% DC(F,S,P)=exp(-pi(F/S)^2+jP)

%

% PS: The term DC(F,S,P) compensates the inherent DC component produced

% by the Gaussian envelop as shown by Movellan in [1]

%

% Tips:

% 1) To get the real part and the imaginary part of the complex

% filter output use real(gabout) and imag(gabout), respectively;

%

% 2) To get the magnitude and the phase of the complex filter output

% use abs(gabout) and angle(gabout), respectively

% Author: Stiven Schwanz Dias e-mail: stivendias@gmailcom

% Cognition Science Group, Informatic Department,

% University of Esp韗ito Santo, Brazil, January 2007

%

% References:

% [1] Movellan, J R - Tutorial on Gabor Filters Tech rep, 2002

function [G,GABOUT]=gaborfilter(I,S,F,W,P);

if isa(I,'double')~=1

I=double(I);

end

size=fix(15/S); % exp(-15^2pi) < 01%

%k=2piS^2;

%F=S^2/sqrt(2pi);

k=1;

for x=-size:size

for y=-size:size

G(size+x+1,size+y+1)=kexp(-piS^2(xx+yy))

(exp(j(2piF(xcos(W)+ysin(W))+P))-exp(-pi(F/S)^2+jP));

end

end

GABOUT=conv2(I,double(G),'same');

%我觉得是你计算 PSNR的方法错了,应该是用最大像素值,

%灰度图像的最大像素值是255, 而不是512。

%另外计算MSE也不用那么麻烦

%下面是计算 MSE和PSNR的程序,我拿一张试了一下,结果肯定是不一样的。

%还有统计像素值出现的次数,用直方图imhist会更简单点,这个程序我没写。

I=imread('boatbmp');

J=imnoise(I,'gaussian',0,001);

Jg=double(J);

%均值滤波

k1=filter2(fspecial('average',3),Jg);

k2=filter2(fspecial('average',5),Jg);

figure,subplot(221),imshow(I);title('原图');

subplot(222),imshow(J);title('加入高斯白噪声以后的图像');

subplot(223),imshow(uint8(k1));title('33模板均值滤波');

subplot(224),imshow(uint8(k2));title('55模板均值滤波');

%中值滤波

k3=medfilt2(Jg,[3 3]);

k4=medfilt2(Jg,[5 5]);

figure,subplot(221),imshow(I);title('原图');

subplot(222),imshow(J);title('加入高斯白噪声以后的图像');

subplot(223),imshow(uint8(k3));title('33模板中值滤波');

subplot(224),imshow(uint8(k4));title('55模板中值滤波');

%计算均值滤波后图像的PMSE与PSNR

diff=(double(I)-k1)^2;

mse=mean(diff(:));

pmse_avg=mse;

max_value=max(k1(:));

psnr=double(10log(max_valuemax_value/mse)/log(10));

%计算中值滤波后的各项指标

diff=(double(I)-k3)^2;

mse=mean(diff(:));

max_value=max(k3(:));

pmse_mid=mse;

psnr_mid=double(10log(max_valuemax_value/mse)/log(10));

PSF

=

fspecial('motion',len,ang);

%建立扩散子,其中len是模糊长度,ang是模糊角度

img2=deconvlucy(img,PSF,n);

%用lucy-richardson方法复原图像,其中img是运动模糊图像,PSF是扩散子,n是迭代次数,img2是复原图像

f=fft2(J); %采用傅里叶变换g=fftshift(f); %数据局陈平衡[M,N]=size(f);n1=floor(M/2);n2=floor(N/2);d0=10;for i=1:Mfor j=1:Nd=sqrt((i-n1)^2+(j-n2)^2);if d>=d0h1=1;h2=1+05;elseh1=0;h2=05;endg1(i,j)=h1g(i,j);g2(i,j)=h2g(i,j);endendg1=ifftshift(g1);g1=uint8(real(ifft2(g1))); %显示理想高通滤波结果figure(3);imshow(g1);title('理想高通滤波结果')g2=ifftshift(g2);g2=uint8(real(ifft2(g2)));figure(4);imshow(g2); %显示理想高通加强滤波结果title('理想高通加强滤波结果')

以上就是关于图象加权中值滤波的MATLAB实现全部的内容,包括:图象加权中值滤波的MATLAB实现、利用matlab给图像进行中值滤波...、求在matlab上实现gabor滤波器对图像处理的程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/9490065.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存