matlab中deconvwnr函数是什么

描述

这个函数是用PSF即点分布函数来修复图形的。

imfilter函数 filtfilt函数imfilter函数 filtfilt函数


imfilter函数 filtfilt函数


J = deconvwnr(I, PSF) restores image I that was degraded by convolution with a point-spread function PSF and sibly by additive noise. The algorithm is optimal in a sense of least mean square error between the estimated and the true image, and uses the correlation matrs of image and noise. In the absence of noise, the Wiener filter reduces to the ideal inverse filter.

J = deconvwnr(I, PSF, NSR) where NSR is the noise-to-signal power ratio. NSR could be a scalar or an array of the same size as I. The default value is 0.

J = deconvwnr(I, PSF, NCORR, ICORR) where NCORR and ICORR are the autocorrelation functions of the noise and the original image, respectively. NCORR and ICORR can be of any size or dimension not exceeding the original image. An N-dimensional NCORR or ICORR array corresponds to the autocorrelation within each dimension. A vector NCORR or ICORR represents an autocorrelation function in the first dimension if PSF is a vector. If PSF is an array, the 1-D autocorrelation function is extrapolated by symmetry to all nonsingleton dimensions of PSF. A scalar NCORR or ICORR represents the power of the noise or the image.

Note The output image J could exhibit ringing introduced by the discrete Fourier transform used in the algorithm. To reduce the ringing, process the image with the edgetaper function prior to calling the deconvwnr function. For example, I = edgetaper(I,PSF)

Class Support

I can be of class uint8, uint16, int16, single, or double. Other inputs he to be of class double. J has the same class as I.

Examples

I = checkerboard(8);

noise = 0.1randn(size(I));

PSF = fspecial('motion',21,11);

Blurred = imfilter(I,PSF,'circular');

BlurredNoisy = im2uint8(Blurred + noise);

NSR = sum(noise(:).^2)/sum(I(:).^2);

% noise power

NP = abs(fftn(noise)).^2;

NPOW = sum(NP(:))/prod(size(noise));

NCORR = fftshift(real(ifftn(NP)));

% original image power

IP = abs(fftn(I)).^2;

IPOW = sum(IP(:))/prod(size(I));

% image autocorrelation function, centered

ICORR = fftshift(real(ifftn(IP)));

ICORR1 = ICORR(:,ceil(size(I,1)/2));

% noise to power ratio

NSR = NPOW/IPOW;

subplot(221);imshow(BlurredNoisy,[]);

title('A = Blurred and Noisy');

subplot(222);imshow(deconvwnr(BlurredNoisy,PSF,NSR),[]);

title('deconvwnr(A,PSF,NSR)');

title('deconvwnr(A,PSF,NCORR,ICORR)');

subplot(224);imshow(deconvwnr(BlurredNoisy,PSF,NPOW,ICORR1),[]);

title('deconvwnr(A,PSF,NPOW,ICORR_1_D)');

图像的维纳滤输出图像的大小与被扩展图像的大小相同波复原

请教关于matlab中imfilter函数的使用

通过使用相关来完成,该值为默认。

功能:对任意类型数组或图像进行滤波。

用法:B = imfilter(A,H)

B = imfilter(A,H,option1,option2,...)

或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options)

filtering_mode

‘corr’

‘conv’

通过使用卷积来完成

boundary_options

输入图像的边界通过用值X(无引号)来填充扩展

其默认值为0

‘replicate’

图像大小通过外边界的值来扩展

‘symmetric’

图像大小通过镜像反射其边界来扩展

‘circular’

图像大小通过将图像看成是一个二维周期函数的一个周期来扩展

size_op矩阵比较大小, 这要看你怎么定义的tions

‘full’

‘same’

输出图像的大小与输入图像的大小相同。这可通过将滤波掩模的中心点的偏移限制到原图像中包含的点来实现,该值为默认值。

imshow(originalRGB)

h = fspecial('motion', 50, 45);%创建一个滤波器

figure, imshow(filteredRGB)

请教关于matlab中imfilter函数的使用

‘X’

功能:对任意类型数组或图像进行滤波。

max = max(max(B)) B中元

用法:B = imfilter(A,H)

B = imfilter(A,H,option1,option2,...)

或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options)

filtering_mode

‘corr’

‘conv’

通过使用卷积来完成

boundary_options

输入图像的边界通过用值X(无引号)来填充扩展

其默认值为0

‘replicate’

图像大小通过外边界的值来扩展

‘symmetric’

图像大小通过镜像反射其边界来扩展

‘circular’

图像大小通过将图像看成是一个二维周期函数的一个周期来扩展

size_options

‘full’

‘same’

输出图像的大小与输入图像的大小相同。这可通过将滤波掩模的中心点的偏移限制到原图像中包含的点来实现,该值为默认值。

imshow(originalRGB)

h = fspecial('motion', 50, 45);%创建一个滤波器

figure, imshow(filteredRGB)

谁有spfilt和intrans函数的M文件

f = charmean(g,m,n,Q);

function f = spfilt(g, type, m, n, parameter)

I can be an N-dimensional array.

%% f = spfilt(g, 'amean', m, n) 算术平均

% f = spfilt(g, 'gmean', m, n) 几何平均

% f = spfilt(g, 'hmean', m, n) 谐函数平均

% f = spfilt(g, 'chmean', m, n,Q) contraharmonic 平均

% f = spfilt(g, 'median', m, n) 中值

% f = spfilt(g, 'max', m, n) 值

% f = spfilt(g, 'min', m, n) 最小值

% f = spfilt(g, 'midpoint', m, n) 中点

% f = spfilt(g, 'atrimmed', m, n,D) alpha-trimmed 平均

%if nargin == 2

m = 3; n = 3; Q = 1.5; d = 2;

elseif nargin == 5

Q = parameter; d = parameter;

elseif nargin == 4

Q = 1.5; d = 2;

else

error('Wrong number of inputs.');

end

switch type

case 'amean'

w = fspecial('erage',[m,n]);

f = imfilter(g,w,'replicate');

case 'gmean'

f = gmean(g,m,n);

case 'hmean'

f = harmean(g,m,n);

case 'chmean'

f = medfilt2(g, [m,n], 'symmetric');

case 'max'

f = ordfilt2(g,mn,ones(m,n),'symmetric');

case 'min'

f = ordfilt2(g,1,ones(m,n),'symmetric');

case 'midpoint'

f1 = ordfilt2(g,1,ones(m,n),'symmetric');

f2 = ordfilt2(g,mn,ones(m,n),'symmetric');

f = imlincomb(0.5,f1,0.5,f2);

if (d<0) | (d/2~=round(d/2))

error('d must be a nonnegative, n integer.')

end

f = alphatrim(g,m,n,d);

otherwise

error('Unknown filter type.')

end

请教关于matlab中imfilter函数的使用

subplot(223);imshow(deconvwnr(BlurredNoisy,PSF,NCORR,ICORR),[]);

请教关于matlab中imfilter函数的使用

功能:对任意类型数组或case 'median'图像进行滤波。

用法:B = imfilter(A,H)

B = imfilter(A,H,option1,option2,...)

或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options)

matlab中灰度图像矩阵的大小问题怎么作?

% noise autocorrelation function, centered

灰度的数字图像中,每个像素用一个数表示,整个图像用矩阵表示,矩阵的行数就是图像的高,矩阵的列数就是图像的宽。

选项

对于彩色图像需要三通道表示,matlab里表示为三维矩阵,其中第三维的长度是3。

imresize函数可以改变图像矩阵的尺寸,可以直观理解为不保持宽高比的任意缩放。当然可以用截取的方法缩小图像尺寸。

灰度图像加模糊的方法很多,最简单的是用均值滤波,而不是乘以矩阵。请看imfilter函数。

加噪声用imnoise函数。

如果数据是二维整数,当两个实现不能通过几个代表性的数据说明问题的时候,可以尝试将所有的数据都运行出来,然后相互比较,用matlab矩阵灰度图表示。矩阵灰度图的X轴和Y轴,就是二维数据。使用imshow()画矩阵。

如果数据是一维整数,类同,只不过使用plot()函数画。

请教关于matlab中imfilter函数的使用

% noise-to-power ratio

功能:对任意类型数组或图像进行滤波。

用法:B = imfilter(A,H)

B = imfilter(A,H,option1,option2,...)

或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options)

filtering_mode

‘corr’

‘conv’

通过使用卷积来完成

boundary_options

输入图像的边界通过用值X(无引号)来填充扩展

其默认值为0

‘replicate’

图像大小通过外边界的值来扩展

‘symmetric’

图像大小通过镜像反射其边界来扩展

‘circular’

图像大小通过将图像看成是一个二维周期函数的一个周期来扩展

size_options

‘full’

‘same’

输出图像的大小与输入图像的大小相同。这可通过将滤波掩模的中心点的偏移限制到原图像中包含的点来实现,该值为默认值。

imshow(originalRGB)

h = fspecial('motion', 50, 4描述5);%创建一个滤波器

figure, imshow(filteredRGB)

matlab中灰度图像矩阵的大小问题怎么作?

filteredRGB = imfilter(originalRGB, h);

灰度的数字图像中,每个像素用一个数表示,整个图像用矩阵表示,矩阵的行数就是图像的高,矩阵的列数就是图像的宽。

case 'atrimmed'

A>B是说A中所有元素都大于B中对应元素

既然这样定义, 如果有一个元素小于的话,A>B当然不成立

min = min(min(A)) A中最小元

如果 min > max

按你的定义, 则有 A>B

对于彩色图像需要三通道表示,matlab里表示为三维矩阵,其中第三维的长度是3。

imresize函数可以改变图像矩阵的尺寸,可以直观理解为不保持宽高比的任意缩放。当然可以用截取的方法缩小图像尺寸。

灰度图像加模糊的方法很多,最简单的是用均值滤波,而不是乘以矩阵。请看imfilter函数。

灰度图应该是二维矩阵,维数不同是因为图像大小不同。。。

变成方的当然可以,你也就变方了。从某种角度讲,算是你处理了一下你的,会造成信息损失的。

Vector3中normalized和Normalize函数的区别

举例:originalRGB = imread('peppers.png');

clc; clear; I=imread('a.jpg'); %读取图像 K1=medfilt2(I,[10 10]); %值滤波 h1=ones(5,5)/25; K2=imfilter(K1,h1); %均值滤波 figure, imshow(K2), title('滤波图像')

其中,f为输入图像,w为滤波掩模,g为滤波后图像。filtering_mode用于指定在滤波过程中是使用“相关”还是“卷积”。boundary_options用于处理边界充零问题,边界的大小由滤波器的大小确定。具体参数选项见下表: