polynomial approximation of 2d image patch -part 2
TRANSCRIPT
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
1/14
PolynomialApproximation of
2D image -Part 2Pi19404
February 18, 2014
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
2/14
Contents
Contents
0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
0.1.1 Poynomial Interpolation . . . . . . . . . . . . . . . . . . . . . 0.1.2 Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
0.2 code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
3/14
Polynomial Approximation of 2D image -Part 2
Polynomial Approximation of 2Dimage -Part 2
0.1 Introduction
In this article we will look at polynomial approximation of image neigh-borhood and efficient implementation in C/C++ OpenCV platform.
In the earlier articles we looked at how to represent a imageregion using quadratic polynomials
Here we will look at efficient way to compute the polynomialbasis representation of an image.
The concept of seperable symmetric/anit symmetric convolutionfilters described in the earlier articles will be also useful.
The first step is the computation of seperable filter coeffi-cients
The basis functions are as shown in figure 1a
0.1.1 Poynomial Interpolation
Let us assume that the neighborhood is approximated by a quadraticpolynomial
We known the value of ie the image values at all pointsin the image
Let us consider a rectangular neighborhood of size
abouta point.
The aim is to find the coefficients
for this neigh-borhood.
The x and y value ranges from
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
4/14
Polynomial Approximation of 2D image -Part 2
(a) 2D basis function
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
5/14
Polynomial Approximation of 2D image -Part 2
For each eg we can equate it with gen-eral form of
to get a equation.
These set of equations can be written in form of the matrix
In general it can be written as
This can be expressed as
The matrix can be expressed as
This matrix simply compute the projection of basis onto image
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
6/14
Polynomial Approximation of 2D image -Part 2
neighborhood being considered
This can be efficiently computed by performining 6 convolutionoperations on the image
The basis matrix for convolution are
are
The matries are displayed below of a neighhborhood of 7 which
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
7/14
Polynomial Approximation of 2D image -Part 2
are matrices.
Each of these filters can be expressed as product of 2 matrices
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
8/14
Polynomial Approximation of 2D image -Part 2
R,C where R is row vector and C is a column vector
All the filters are weighted by gaussian kernel that gives moreimportance to pixels near the origin,and can be considered asweighted interpolation.
0.1.2 Code
The source code can be found at git repository
To realize the basis function ,seperable filter for a size 7 areshown below
http://localhost/var/www/apps/conversion/tmp/scratch_3/ -
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
9/14
Polynomial Approximation of 2D image -Part 2
a dot product of
kernels specified above will provided
a 2D kernel corresponding to basis function specfied in the
figure 1a based on the desired size of the neighborhood beingapproximated.
It can be noted that the filter coefficients are symmetric andare either symmetic or anti symmetric and are all of the samesize.
The function to generate the filter coeffients is implementedby the function
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
10/14
Polynomial Approximation of 2D image -Part 2
The result of the various filters can be computed by making asingle pass over the entire image
The class is used for achieving this.
The details of seperable convolution using symmetric/anti-symmetricfilters can be found in the article
The polyBasis class implements the polynomial basis computation
The method implements the com-
putation of seperable filter coefficients.
The last step in estimation required is the matrix
The matrix is 6xN matrix
http://localhost/var/www/apps/conversion/tmp/scratch_3/ -
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
11/14
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
12/14
Polynomial Approximation of 2D image -Part 2
this implies
for a 7x7 neighborhood size we get
This computation is performed by the function
The matrix is called as Vandermonde matrix .
The last step remaining is normalization of the filter coef-ficients as a result of Least sequares estimation process thatrequire application of the matrix on each pixel of multi chan-
nel image.
It can be noted that result of applying the kernel on vectorformed by the channel of length N results in a matrix of length
N.
It can also be noted that the transformation is linear.
This is achieved using the class that can be foundin the article
-
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
13/14
Polynomial Approximation of 2D image -Part 2
Thus a modular and efficient method to compulte the local poly-nomial basis of image is provided in the article.
0.2 code
The code for the same can be found in the git repository
in files ImgBasis/polybasis.cpp andImgBasis/polybasis.hpp files.
https://github.com/pi19404/OpenVisionhttps://github.com/pi19404/OpenVision -
8/13/2019 Polynomial Approximation of 2D image patch -Part 2
14/14
Bibliography
Bibliography
http://dblp.uni-trier.de/db/journals/sigpro/sigpro87.html#AnderssonWK07http://dblp.uni-trier.de/db/journals/sigpro/sigpro87.html#AnderssonWK07http://dblp.uni-trier.de/db/conf/icmcs/icme2002-1.html#AnderssonK02http://dblp.uni-trier.de/db/conf/icmcs/icme2002-1.html#AnderssonK02