**Appendix**

In this section we provide the interested readers with the Matlab codes used in this article.

The following Matlab functions where used to calculate the Fourier and the Haar basis coefficients, and the blurring matrix of the images used.

**Function that calculates the Fourier Basis Coefficients (FBC) of an image.**

```
%***************************%
% General Information. %
%***************************%
% Synopsis:
% FB= FBC (b_r,b_c)
%Input:
% b_r : rows of FB,
% b_c : columns of FB
```

```
%
%Output: FB: Fourier base
function FB= FBC (b_r,b_c)
FB=zeros(b_r,b_c); i=(b_c-1)/2;
  for j=1:b_c
    l=(j-i-1);
    for k=1:b_r
      FB(k,j)=exp(-j*2*pi*((k-1)*l)/b_r);
    end
  end
FB=(1/sqrt(b_r))*FB;
```
16 Will-be-set-by-IN-TECH

in order to obtain an approximation of the original image. By using the proposed algorithm, the resolution of the reconstructed image remains at a very high level, although the main advantage of the method was found on the computational load that has been decreased considerably compared to the other methods and techniques. The efficiency of the generalized inverse is evidenced by the presented simulation results. In this chapter the results presented were demonstrated in the spatial and spectral domain of the image. Orthogonal moments have demonstrated significant energy compaction properties that are desirable in the field of image processing, especially in feature and object recognition. The advantage of representing and recovered any image by choosing a few Haar coefficients (spatial domain) or Fourier coefficients (spectral domain), is the faster transmission of the image as well as the increased robustness when the image is subject to various attacks that can be introduced during the transmission of the data, including additive noise. The results of this work are well established by simulating data. Besides digital image restoration, our work on generalized inverse matrices may also find applications in other scientific fields where a fast computation of the

The proposed method can be used in any kind of matrix so the dimensions and the nature of

*Technological Education Institute of Piraeus, Petrou Ralli & Thivon 250, 12244 Aigaleo, Athens,*

In this section we provide the interested readers with the Matlab codes used in this article. The following Matlab functions where used to calculate the Fourier and the Haar basis

*Department of Statistics, Athens University of Economics and Business, Greece*

**Function that calculates the Fourier Basis Coefficients (FBC) of an image.**

coefficients, and the blurring matrix of the images used.

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*% % General Information. % %\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*%

inverse data is needed.

**Author details**

S. Chountasis

V. Katsikis

D. Pappas

**Appendix**

% Synopsis:

%Input:

% FB= FBC (b\_r,b\_c)

% b\_r : rows of FB, % b\_c : columns of FB

*Greece*

the image do not play any role in this application

*Hellenic Transmission System Operator, Greece*

**Function that calculates the Haar Basis Coefficients (HBC) of an image.**

```
%***************************%
% General Information. %
%***************************%
% Synopsis:
% HB=HBC(h_r,h_c)
%Input:
% h_r : rows of HB,
% h_c : columns of HB
%
%Output: HB: Haar base matrix
function HB=HBC(h_r,h_c)
 if (fix(log2(h_r))~=log2(h_r))
    error('The number of rows must be power of 2');
 end
  HB=zeros(h_r,h_c);
  for i=1:h_r
    HB(i,1)=1;
  end
   for l=2:h_c
    k=2^fix(log2(l-1));
    length=h_r/k;
    start=((l-1)-k)*length+1;
    middle=start+length/2-1;
    last=start+length-1;
    v=sqrt(k);
```

```
for j=start:middle
    HB(j,l)=v;
  end
   for j=middle+1:last
     HB(j,l)=-v;
   end
  end
HB=(1/sqrt(h_r))*HB;
```
**Function that calculates the blurring matrix of an image.**

```
%***************************%
% General Information. %
%***************************%
% Synopsis:
% H = buildH(Fo,h)
%Input:
% Fo : original image,
% h : array of blurring process
%
%Output: H: blurring Matrix
function H = buildH(Fo,h)
n = length(h);
N=size(Fo,2);
M=N + n - 1;
H=zeros(N,M);
for j =1:N
H(j,j:j+n-1) = h;
end
```
## **7. References**


*cessing*, 16, 1821-1830.

18 Will-be-set-by-IN-TECH

[1] Banham M. R. & Katsaggelos A. K., (1997) "Digital Image Restoration" *IEEE Signal Pro-*

[4] Campbell S. L. & Meyer C. D. (1977) *Generalized inverses of Linear Transformations*, Dover

[2] Ben-Israel A. & Grenville T. N. E (2002) *Generalized Inverses: Theory and Applications*,

[3] Bovik A. (2009) *The essential guide to the image processing*, Academic Press.

[5] Castleman K. R. (1996), Digital Processing, Eglewood Cliffs, NJ: Prentice - Hall. [6] Chantas J., Galatsanos N. P. & Woods N. (2007), Super Resolution Based on Fast Registration and Maximum A Posteriori Reconstruction, *IEEE Trans. on Image Pro-*

for j=start:middle HB(j,l)=v;

HB=(1/sqrt(h\_r))\*HB;

for j=middle+1:last HB(j,l)=-v;

%\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*% % General Information. % %\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*%

**Function that calculates the blurring matrix of an image.**

end

end end

% Synopsis:

n = length(h); N=size(Fo,2); M=N + n - 1; H=zeros(N,M); for j =1:N

H(j,j:j+n-1) = h;

**7. References**

%Input:

%

end

% H = buildH(Fo,h)

% Fo : original image,

%Output: H: blurring Matrix

*cessing Magazine*, 14, 24-41.

Springer-Verlag, Berlin.

Publ. New York.

function H = buildH(Fo,h)

% h : array of blurring process

	- [27] Teh C. H., Chin, R. T. (1988) On image analysis by the methods of moments. *I*EEE Trans. Pattern Anal. Machine Intell, 10, 496-513.
	- [28] Trussell H.J. & S. Fogel,(1992) Identification and Restoration of Spatially Variant Motion Blurs in Sequential Images, *I*EEE Trans. Image Proc., 1, 123-126.
	- [29] Tull D. L & Katsaggelos A.K.,(1996) Iterative Restoration of Fast Moving Objects in Dynamic Images Sequences, *Optical Engineering*, 35(12), 3460-3469.
	- [30] Wang G., Wei Y. & Qiao S. (2004) *Generalized Inverses: Theory and Computations*, Science Press, Beijing/New York.
