I am trying to write a Matlab code to produce motion and Gaussian blur. Here is my code:
f0=imread('cameraman.png');
[Nx,Ny,Nz]=size(f0);
if Nz>1;f0=double(rgb2gray(f0));
else
f0=double(f0);
end
blurfilter1 = fspecial('gaussian', [7 7], 1);
blurfilter2 = fspecial('motion',5,30);
Au = @(u) imfilter(u,blurfilter1,'symmetric');
Bu = @(u) imfilter(u,blurfilter2,'symmetric');
In above code, operators Au and Bu will produce Gaussian blur and motion blur respectively. However, I need these two operators to be self-adjoint. I have found the following code for producing self-adjoint opearots but I am not sure whether it works for both Gaussian and blur operators. Here is the code:
Au = @(u) imfilter(imfilter(u,blurfilter1,'symmetric'),blurfilter1','symmetric');
Bu = @(u) imfilter(imfilter(u,blurfilter2,'symmetric'),blurfilter2','symmetric');
I really appriciate it if anyone could please help me to build self-adjoint Au and Bu operators for Gaussian and motion blur.