sid*_*rth 2 image image-processing filter
我正在研究逆过滤,我试图编码它,我从网上找到了一些参考.每个人都考虑过光学传递功能,这在我所指的Gonzalez Book中无处可见.
% Inverse_Filter_Demo-
clc
clear all
close all
original_image=imread('cameraman.jpg'); %loading the original (un-blurred) image
original_image=double(original_image);
%The blur function (PSF- Point Spread Function) that will be added to the original image
PSF=fspecial('motion',20,45);
%Adding blur to the original image
degraded_image = imfilter(original_image,PSF,'circular','conv');
OTF= psf2otf(PSF,[size(degraded_image,1) size(degraded_image,2)]);%Getting OTF from PSF
Inverse_Filter=conj(OTF)./((abs(OTF)).^2); %The inverse filter
%Preforming Fourier Transform to the degraded image
FT_degraded_image=fftn(degraded_image);
%Preforming the restoration itself
restored_image=abs(ifftn(FT_degraded_image.*Inverse_Filter));
%Presenting the restoration results:
figure;
set(gca,'Fontsize',14);
colormap(gray);
imagesc(original_image,[0 255]);
truesize;
title('Original image');
figure;
set(gca,'Fontsize',14);
colormap(gray);
imagesc(degraded_image,[0 255]);
truesize;
title('Degraded image');
figure;
set(gca,'Fontsize',14);
colormap(gray);
imagesc(restored_image,[0 255]);
truesize;
title('Restoration of the degraded image (using Inverse Filter)');
Run Code Online (Sandbox Code Playgroud)
你的问题不清楚,可能更适合(dsp.stackexchange.com).但是,如果你问的是"什么是光学传递函数?" 然后维基百科的OTF 文章是一个很好的起点.
最简单的思考方式是光学传递函数是点扩散函数(PSF)的傅立叶变换.通常PSF是一个滤波器(卷积核),它描述了单个针孔型光源如何通过某些器件被涂抹到实际图像中.
OTF只是涂抹过程的幅度/相位表示.滤波器是图像的傅立叶变换在相空间中乘以产生模糊的真实输出图像的傅立叶变换(而不是卷积,这是你在空间域中对PSF所做的).在应用OTF之后应用逆傅里叶变换应该为您提供设备将产生的实际图像.
为了数学方便,有时为了处理效率,使用OTF而不是常规空间域的PSF更为便利.这就是为什么你会看到一些算法和教科书用OTF而不是PSF描述他们的方法.