You are on page 1of 9

# Polynomial approximation of 2D signal

Pi19404
February 6, 2014

Contents

Contents
Polynomial approximation of 1D signal
0.1 Introduction . . . . . . . . . . 0.2 Polynomial Approximation 0.3 2D projection . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . of 2D signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
3 3 3 8

2 | 9

## Polynomial approximation of 2D signal

0.1 Introduction
In this article we will look at the concept for polynomial expansion to approximate a neighborhood of a pixel with a polynomial.

## 0.2 Polynomial Approximation of 2D signal

 

The idea of polynomial expansion is to approximate a neighborhood of a point in a 2D function with a polynomial. Considering only a quadratic polynomial ,pixel values in a neighborhood is given by
f (x) x

Ax

+b

+c

## where A is a symmetric matrix,b is a vector and c is a scalar

  

The coefficients can be estimated by weighted least square estimate of pixel values about neighborhood. Let us consider a polynomial of order 2.The basis functions of the subspace where the local signal is being approximated are
1; x2 ; y 2 ; x; y; xy

The basis function are defined on the discrete grid of -N to N considering a window/neighborhood of (2 N + 1) ,for the present example let N=7;

0.3 2D projection

 

We need to project a 2D function onto these basis As in the case on 1D projection we simply,take the innerproduct of the given signal with the basis 1; x; y; x2 ; y 2 ; xy

3 | 9

4 | 9

## Polynomial approximation of 2D signal

  

To compute the projection parameters ,one can directly take the inner production of the signal with each of the basis. We also need to consider a weighing function ,in the present example we consider a 2D gaussian with variance of 1 along the x and y direction. We get the projection matrix as follows.

0

0 0:9959 0 0 0 0

0 0 0:9959 0 0 0

0 0 0 0 0 0:9918

3 7 7 7 7 7 7 5

(1)

res

= (G 1)

fA

W;

      

T =

## will give us a scalar for each of the basis function

This gives us the projection of the signal onto the basis function The inverse transformation gives us the mean square estimate of the polynomial function in the local neighborhood about the point. In the below function we are obtaining the polynomial estimate of the function 5x2 + 10x + 3 The below matlab sript computes the 2D polynomial approximation At (4; 4) of result array we get the coefficients This corresonds to result translated by 3.
[78; 40; 0; 5; 0; 0]

5 | 9

## Polynomial approximation of 2D signal

%generating the meshgrid [bx,by]=meshgrid(x,y); %gaussian weighing function ax=exp((-bx.^2-by.^2)/(2*sigma.^2)); ax=ax/sum(sum(ax)); figure(1); surf(bx,by,ax); shading interp; %the basis functions figure(2); b0=ones(N,N); b1=bx; b2=by; b3=bx.^2; b4=by.^2; b5=by.*bx; subplot(3,2,1) surf(bx,by,b0); grid on; shading interp; subplot(3,2,2) surf(bx,by,b1) grid on; shading interp; subplot(3,2,3) surf(bx,by,b2) grid on; shading interp; subplot(3,2,4) surf(bx,by,b3) grid on; shading interp; subplot(3,2,5) surf(bx,by,b4)

6 | 9

## Polynomial approximation of 2D signal

grid on; shading interp; subplot(3,2,6) surf(bx,by,b5) grid on; shading interp; %y=ones(N,N); %computing the G matrix G=B'*W*B=AA' G1=zeros(6,6); G1(1,1)=sum(sum(ax.*b0)); G1(2,2)=sum(sum(ax.*b4)); G1(4,4)=sum(sum(ax.*b4.^2)); G1(6,6)=sum(sum(ax.*bx.^2.*by.^2)); G1(3,3) =G1(2,2); G1(1,4) = G1(2,2); G1(1,5) = G1(2,2); G1(4,1) = G1(2,2); G1(5,1) = G1(2,2); G1(5,5) = G1(4,4); G1(4,5) = G1(6,6); G1(5,4)= G1(6,6);

xx=0:20; yy=0:20; [xx,yy]=meshgrid(xx,yy); S=5*xx.^2+10*xx+3; %computing the matrix A'*I for each of the basis function f0 = b0.*ax; f0 = f0(end:-1:1,end:-1:1); f1 = b1.*ax; f1 = f1(end:-1:1,end:-1:1); f2 = b2.*ax; f2 = f2(end:-1:1,end:-1:1); f3 = b3.*ax; f3 = f3(end:-1:1,end:-1:1); f4 = b4.*ax; f4 = f4(end:-1:1,end:-1:1); f5 = b5.*ax; f5 = f5(end:-1:1,end:-1:1); r1=imfilter(S,f0,'conv','replicate');

7 | 9

## r2=imfilter(S,f1,'conv','replicate'); r3=imfilter(S,f2,'conv','replicate'); r4=imfilter(S,f3,'conv','replicate'); r5=imfilter(S,f4,'conv','replicate'); r6=imfilter(S,f5,'conv','replicate');

%computing the means square estimate using normalized convoltion res=arrayfun(@(x1,x2,x3,x4,x5,x6)inv(G1)*[x1;x2;x3;x4;x5;x6],r1,r2,r3,r4,r5,r6 %displaying the value of function at x-3 cell2mat(res(4,4))

8 | 9

Bibliography

Bibliography
[1] Kenneth Andersson and Hans Knutsson.  Continuous normalized convolution. In: ICME (1). IEEE, 2002, pp. 725728.

[2]

isbn:

0-7803-7304-9.

url: http://

Kenneth Andersson, Carl-Fredrik Westin, and Hans Knutsson.  Prediction from 87.3 (Mar. 22, 2007), pp. 353365. url: http://dblp.uni- trier.de/db/ journals/sigpro/sigpro87.html#AnderssonWK07. o-grid samples using continuous normalized convolution. In: Signal Processing

[3]

Gunnar Farnebck.  Motion-based Segmentation of Image Sequences. LiTH-ISYEX-1596. MA thesis. SE-581 83 Linkping, Sweden: Linkping University, 1996.

[4]

Gunnar Farnebck.  Polynomial Expansion for Orientation and Motion Estimation. Dissertation No 790, ISBN 91-7373-475-6. PhD thesis. SE-581 83 Linkping, Sweden: Linkping University, Sweden, 2002.

[5]

Gunnar Farneback.  Two-Frame Motion Estimation Based on Polynomial Expansion. In: SCIA. LNCS 2749. Gothenburg, Sweden, 2003, pp. 363370.

9 | 9