Facial Recognition Using Taylor Series
Facial Recognition Using Taylor Series
November 2022
GROUP MEMBERS
1. Name : Makhani Arman Barkatbhai ID : 202103006
2. Name : Harsh Shashikantbhai kanani ID : 202103050
3. Name : Srushti Nitinbhai Kaneriya ID : 202103037
Module 1 (Differential Calculus)
Using Taylor’s series in facial expression recogni-
tion
Local binary pattern:
LBP is basically a texture operator which labels the pixels of an image
by thresholding the neighborhood of each pixel and considers the result
as a binary number. Let’s take an example to understand it better . pc
is the center pixel value . it is surrounded by N pixels then we define
a function S(pc , pn ) which gives the value 1 if pc ≥ pn and 0 otherwise.
and LBP is found by adding the product of S(pc , pn ) and 2n for n=0
to N-1.
NP−1
In short , LBP (Xc , Yc ) = S(pc , pn ) ∗ 2n
n=0
Looking at the image , it will be pretty clear on how to find the
LBP.First calculate the binary function nS and then just add the prod-
uct with 2n as mentioned before. But there is a more accurate way to
do the same which we will understand in the later part.
Figure below shows the texture unit with 3X3 of 1st order Taylor pixel
feature f1 (pc ) and 5X5 of the 2nd order Taylor pixel feature f2 (pc ).
Grey implies the first layer of texture unit , and dark grey indicates
the second layer of the texture unit.
So , f1 (pc ) is expressed as:
f ( 0)(ϕ)(pc −ϕ)0 f ( 1)(ϕ)(pc −ϕ)1
f1 (pc ) = 0! + 1!
where (
1; pc − ϕ ≥ 0
f (x) =
−1; pc − ϕ < 0
where (
1; pc − ϕ ≥ 0
f (1) (ϕ) =
−1; pc − ϕ < 0
(
1; (pc − ϕ1 )(pc − ϕ2 ) ≥ 0
f (2) (ϕ) =
−1; (pc − ϕ1 )(pc − ϕ2 ) < 0
where f (0) (ϕ) is the average if all the pixels value 2n d order texture2(t2)
while ϕ1 is the average of all the pixels value which comes under the
1s t layer , ϕ2 is the average of all the pixels value of the 2n d layer in
the T2 and ϕ is the average of all the pixels value that comes in the
1s t layer and 2n d layer of T2.
8
X
TFP = S(fn (pc ), fn (pj ))2j−1
j=1
Input image
where the RHS indicates the laplacian in x and y axis. Now , applying
laplace transformation ,
where √ √ √ √
p8 / 2 + p7 + p6 / 2 + p4 / 2p3 + p2 / 2
ϕ= √
4/ 2 + 2
where (Pi)s are all the pixels.
and
√ √ √ √
p8 / 2 + p1 + p2 / 2 + p4 / 2 + p5 + p6 / 2
ψ= √
4/ 2 + 2
2
f2 (pc ) = f (ϕ, ψ) + [(pc − ϕ) ∂f ∂f 1 2∂ f
∂x + (pc − ψ) ∂y ] + 2 [(pc − ϕ) ∂x2 + 2(pc −
2 2
∂ f
ϕ)(pc − ψ) ∂x∂y + (pc − ψ)2 ∂∂yf2 ](1)
ϕ1 , ψ1 , ϕ2 and ψ2 are used in the computation of ϕ and ψ. So , we
will look into their definition.
√1 p8 +p7 + √1 p6 + √1 p4 +p3 + √1 p2
2 2 2 2
ϕ1 = √4 +2
2
ψ = ψ1 +ψ
2
2
Then ,
ϕ+ψ
f (ϕ, ψ)
( = 2 and then we calculate the partial derivatives
1
∂f 2; pc − ϕ1 ≥ 0
∂x = 1
− 2 ; p c − ϕ1 < 0
(
1
∂f 2; pc − ψ1 ≥ 0
∂y =
− 12 ; pc − ψ1 < 0
(
1
2
∂ f 4; (pc − ϕ1 )(pc − ϕ2 ) ≥ 0
∂x 2 =
− 14 ; (pc − ϕ1 )(pc − ϕ2 ) < 0
(
1
2
∂ f 4; (pc − ϕ1 )(pc − ϕ2 ) ≥ 0
∂y 2 =
− 14 ; (pc − ϕ1 )(pc − ϕ2 ) < 0
(
1
2
∂ f 4; (pc − ϕ2 )(pc − ψ2 ) ≥ 0
∂x∂y =
− 41 ; (pc − ϕ1 )(pc − ψ2 ) < 0
Now the last step is taylor feature pattern generation. We will map all
the face images into pixel taylor feature space and the resulting image
gets seperated by blocks.
Now , we will look into the 2D taylor feature pattern of each taylor
feature and the formula is very similar to 1D.
P8 m
TFP of 2D = m=1 S(fn (pc ), fn (pm )))2 −1
n
where S(pc , pm ) = 1; pc ≥ pm 0; otherwise
ZZ Ztop
f (x, y, z)
shadowbottom
p
Consider the z - axis as the vertical so that the
p cone z = x2 + y 2
becomes the bottom and half the sphere z = 1 − x2 − y 2 becomes
the top of the ice cream cone W. Hence W is the surface between these
two surfaces.
p p
x2 + y 2 ≤ z ≤ 1 − x2 − y 2 (2)
Hence finding the rest of bounds for integral values become quite easier
from this shadow region inequality as in Eq.(2).
Now we will consider y to be the interior integral of the double integral.
Hence we need to describe the range of y from the shadow region as a
function of x. So for this we rewrite inequality as
r r
1 1
− − x2 ≤ y ≤ − x2 (4)
2 2
Hence this range gives bounds of the inner integral of the double inte-
gral. And for the bounds of the outer integrals the maximal range of x
is required. From the inequality Eq.(2) we can say that maximal value
of x occurs when y becomes 0. Hence x2 ≤ 12 . Therefore the maximal
range of x can be return as
1 1
−√ ≤ x ≤ √
2 2
Hence we have found bounds of all the three integrals. Combining all
the limits together with the shadow limits, the ice cream cone can be
represented by the inequalities as below
1 1
−√ ≤ x ≤ √
2 2
r r
1 1
− − x2 ≤ y ≤ − x2
2 2
p p
x2 + y 2 ≤ z ≤ 1 − x2 − y 2
And the integral function f(x, y, z) over W is
√1 2 √ 2 2
ZZZ Z √1 Z2 −x 1−x −y f (x,y,z) dz dy dx
Z
2
f dV =
− √12 √ √2 2
W 1 2 − 2 −x x +y
For finding the volume consider the f(x, y, z) = 1 and perform the
integration.
√1 2 √ 2 2
Z √1 Z2 −x 1−x −y
Z
2
V olume = dz dy dx
− √12 √ √2 2
1 2 − 2 −x x +y
Z 0 Z √
1−x 2 Z √7−x 2 −y 2
√ √ 18y dz dy dx
−1 − 1−x 2 6x 2 +6y 2
Solution :
Now , converting the coordinates into spherical coordinates makes the
problem a lot easier. First , let’s consider the z limits.
√ −1 ≤ x ≤ √ 0
2 2
p − 1 − x ≤ y ≤p 1 − x
6x2 + 6y 2 ≤ z ≤ 7 − x2 − y 2
p
z= 7 − x2 − y 2
√
is an equation of upper portion of the sphere with radius 7 and
p
z = 6x2 + 6y 2
is an equation of cone.
From that we get ,
√
0≤ρ≤ 7
For the limits of φ , we will again
p consider the cone’s equation which
is the lower limit for z.Putting x2 + y 2 = r and r = ρ sin φ , we get
√ 1
ρ cos φ = 6ρ sin φ → So, tan φ = √
6
−1 1
then, φ = tan √ = 0.3876
6
So , we get the limits of φ from 0 to 0.3876.
y limits tells us that we are inside a circle of radius 1 and we also know
that intersection of sphere and cone will lead us to a circle. x limits
tells us that we should take left side of the circle. So , based on that ,
π 3π
≤θ≤
2 2
So , we have gotten all the three coordinates.
Z Z √ 2Z √ 2 2
0 1−x 7−x −y
√ √ 18y dz dy dx
−1 − 1−x 2 6x 2 +6y 2
3π
√
Z 0.3876 Z 2
Z 7
(18ρ sin φ sin θ) ρ2 sin φ dρ dθ dφ
=
π
0 2 0
3π
√
Z 0.3876 Z 2
Z 7
= 18ρ3 sin2 φ sin θ dρ dθ dφ
π
0 2 0
Z 0.3876 Z 3π √7
2 9 4 2
= ρ sin φ sin θ dθ dφ
0 π
2
2 0
3π
Z 0.3876 Z
441 2 2
= sin φ sin θ dθ dφ
0 π
2
2
Z 0.3876 3π2
441 2
= − sin φ cos θ dφ
0 2 π
2
Z 0.3876
= 0 dφ = 0
0
Problem 3 :
Evaluate the triple integral
ZZZ p
x2 + z 2 dV
E
Solution :
The region above y = 4 and below the parabola y = x2 that defines
the solid region E’s projection onto the xy-plane is shown below.
Thus we have
p p
2
E = {(x, y, z)| − 2 ≤ x ≤ 2, x ≤ y ≤ 4, − y − x ≤ z ≤ y − x2 }.
2
The triple integration becomes as follows
√
x=2 y=4 z= y−x2
ZZZ p Z Z Z p
2 2
x + z dV = x2 + z 2 dz dy dx
E x=−2 y=x2
√ 2
z=− y−x
√ 2
ZZZ p Zx=2 Zy=4 z= Z y−x p
x2 + z 2 dV = x2 + z 2 dz dy dx
E x=−2 y=x2 z=−
√
y−x2
√
Zx=2 z=Z 4−x2 Zy=4 p
= x2 + z 2 dy dz dx
√
x=−2 z=− 4−x2 y=x2 +z 2
In the upcoming steps of the computation it will be clear how this will
be useful for us in easy computation.
Now integrating firstly with respect to y we obtain
√ √
Zx=2 z=Z 4−x2 Zy=4 p Zx=2 z=Z 4−x2
p
2 2
x2 + z 2 dy dz dx = (4−x −z ) x2 + z 2 dz dx
√ √
x=−2 z=− 4−x2 y=x2 +z 2 x=−2 z=− 4−x2
Now further simplification of the calculation lets use the polar substi-
tution for x and z as follows
x = r cos θ
z = r sin θ
And hence
dz dx = r dr dθ
r2 = x2 + z 2
Z2/pi" 3
# 5 2
4r r
= − dθ
3 5 0
0
Z2π
64
= dθ
15
0
128π
=
15
We will use Stokes theorem to convert the line integral into sur-
face integral. Also , As the integration is happening over space ,
d/dt can go inside the integral and it won’t affect anything. So
, because we don’t want any changes we write d/dt in the form
of partial derivation when we send it inside the integral.
Z Z Z ⃗
∂E
⃗ Bn̂
∇ ⃗ dA = µo J⃗ · n̂ dA + µo ϵo · n̂ dA
A A A ∂t
Z ⃗
⃗B
(∇ ⃗ − µo J⃗ − µo ϵo ∂ E ) · n̂ dA = 0
A ∂t
⃗
⃗B
∇ ⃗ = µo J⃗ + µo ϵo ∂ E ..........(∗)
∂t
Equation * represents the differential form of ampere’s law.
• Gauss law in Electric field
Gauss law in electric field is given by
I
⃗ · n̂dA = qen
E
ϵ
⃗ =ρ
⃗ ·E
∇
ϵ
Above equation represents the Gauss law in electric field in dif-
ferential form.
• Gauss law in Magnetic field
Gauss law in Magnetic field is given by
I
⃗ · n̂dA = 0
B
⃗ ·B
∇ ⃗ =0
I Z ⃗
dB
⃗ · dr = −
E · n̂dA
A dt
Now we will convert the use the stoke’s theorem to convert line
integral to surface integral. So on applying the stoke’s theorem,
we get
Z Z ⃗
dB
⃗ ×E
∇ ⃗ · n̂dA = − · n̂dA
A A dt
Z ⃗
⃗ + dB ) · n̂dA = 0
⃗ ×E
(∇
A dt
Above equation will imply that
⃗
⃗ = − dB
⃗ ×E
∇
dt
Above equation represents the faraday’s law in differential form.
Solution:
We know that we can solve the wave equation by using fourier series.
But it is more convenient to use the D’alemberts solution to solve the
wave equation.
Suppose we wish to solve the wave equation
ytt = c2 yxx
yx = yu ux + yv vx
yx = yu + yv
yt = yu ut + yv vt
yt = a(yu − yv )
Now on putting the value of yxx and ytt in wave equation, we get yuv = 0
which will give
y = ϕ(u) + ψ(v)
(5)
y = ϕ(x + at) + ψ(x − at)
′ ′ g(x)
ϕ (x) − ψ (x) =
c
On Integrating above equation both sides by taking limits from x0 to
x ,we get
1 x
Z
ϕ(x) − ψ(x) = ϕ(x0 ) − ψ(x0 ) + g(s)ds
a x0
1 x
Z
ϕ(x) − ψ(x) = k(x0 ) + g(s)ds
a x0
we can see that the value of y(xp , tp ) depends on the initial data F
at points xp + atp and xp − atp . The interval l = [xp − at, xp + at] is
called the domain of dependence of the solution at point (xp , tp ).The
range of influence R of point P (xp , tp ) is defined as the region of the
solution domain in which the solution is influenced by the solution at
point P (xp , tp ). It is given in the figure given below:
If g(x) = 0, then f(x) is given by
1
y(x, t) = [f (x + at) + f (x − at)]
2
Figure 7: Domain of Independence I , Range of Influence R
Question 1:
Solve the problem
∂ 2y 2
2∂ y
=c , −∞ < x < ∞, t > 0
∂t2 ∂x2
u(x, 0) = F (x), −∞ < x < ∞
ut (x, 0) = 0, −∞ < x < ∞
where
0, −∞ < x < π
F (x) = A sin(x), −π < x < π
0, −π < x < ∞
Solution:
The function F(x) is only non-zero in the finite interval −π < x < π.
According to D’alemberts equation, solution is given by
1
y(x, t) = [F (x + ct) + F (x − ct)]
2
In order to handle the piecewise nature of the function F(x), we can
use Heavyside step function define as .
(
0, x < a
H(x − a) =
a, x > a
A
y(x, t) = [h(x + ct + π) − h(x + ct − π)] sin(x + ct)+
2
A
[h(x − ct + π) − h(x − ct − π)] sin(x − ct)
2
For c = 1, the solution looks like
A
y(x, t) = [h(x + t + π) − h(x + t − π)] sin(x + t)+
2
A
[h(x − t + π) − h(x − t − π)] sin(x − t)
2
Now, let us see the behaviour of the y at different times by taking
A = 1. Figure given below represents the behaviour of function y at
different times.
Figure given above represents that how the initial sinusodial wave de-
composes into two opposite moving waves with unit speed c = 1. After
both the waves seperating at t = π , each wave become the replica of
the initial wave profile with half of its amplitude.
Let us consider the case that when f (x) = 0 , then what will be the
solution of D’alemberts equation.
Figure 8: u(x,t) (solid) showing the average of the two profiles F(x +
ct) and F(x-ct) (dashed)
∂ 2y 2
2∂ y
=c , −∞ < x < ∞, t > 0
∂t2 ∂x2
y(x, 0) = 0, −∞ < x < ∞
yt (x, 0) = G(x), −∞ < x < ∞
Fundamental Solution:
Let us consider an infinite string with initial displacement equal to 0
and initial velocity given by an impulse function at x0 = 0. It means,
∂ 2y 2∂ y
2
−c = 0, −∞ < x < ∞, t > 0
∂t2 ∂x2
f (x) = 0
g(x) = δ(x)
1
u(x, t) = [g(x + ct) − g(x − ct)]
2
1
u(x, t) = [H(x + ct) − H(x − ct)]
2c
This is called the fundamental solution of the wave equation.
Let us solve one problem based on the above concept to get better
understanding.
Question 2:
Consider an infinite string with zero initial displacement and initial
velocity given by the square wave function. That is, we have F(x) = 0
and
0, −∞ < x < −1
G(x) = 1, −1 ≤ x ≤ 1
0, 1 < x < ∞
Solution :
We can represent function G(x) by making use of Heavyside step func-
tion which is given below.
1
u(x, t) = [g(x + ct) − g(x − ct)]
2
1
u(x, t) = [(x + ct + 1)H(x + ct + 1) − (x + ct − 1)H(x + ct − 1)]
2c
1
− [(x − ct + 1)H(x − ct + 1) − (x − ct − 1)H(x − ct − 1)]
2c
For c = 1 , the solution becomes
1
u(x, t) = [(x + t + 1)H(x + t + 1) − (x + t − 1)H(x + t − 1)]
2
1
− [(x − t + 1)H(x − t + 1) − (x − t − 1)H(x − t − 1)]
2
The graph of the function u at different time t is given below:
The effect of an initial velocity G is a wave spreading out at speed
c in opposite direction along the x-axis. After some time t , the two
functions g(x)/2 and -g(x)/2 move a distance ct. The string will reach
a state of rest as t tends to infinity with residual displacement , ust = 1.
Figure 10: u(x,t) (solid) showing the average of the two profiles F(x +
ct) and F(x-ct) (dashed)
∞ ∞
f (x) + f (−x) X nπx X nπx
= a0 + an cos + bn sin
2 n=1
L n=1
L
where
ZL
1
a0 = f (x) dx
2L
−L
ZL
1 nπx
an = f (x) cos dx
L L
−L
ZL
1 nπx
bn = f (x) sin dx
L L
−L
Z∞
f (x) + f (−x) 1
= F (ω)eιωx dω (7)
2 γ
−∞
Hence the Equation pair of equation (4) and equation (5) is known as
Fourier Transform Pair. With the help of all these equation we will
find some of the application of Fourier Transforms in some of the fields
as below :
The last integral in the above equation can be evaluated to get the
following equation r
π −x2
g(x) = e 4α
α
which shows that the inverse Fourier transform of a Gaussian is itself
a Gaussian.
u(x, 0) = f (x)
limx→∞ u(x, y) = 0
limx→−∞ u(x, y) = 0
limy→∞ u(x, y) = 0
Z ∞
1
U (x, y) = u(x, y)eiwx dx
2π −∞
∂ 2U
2
− w2U = 0
∂y
Finding it’s general solution , we get
limy→∞ u(x, y) = 0
limy→∞ U (x, y) = 0
ans so a(w)=0 of w¿0 and b(w)=0 if w¡0. So ,
(
a(w)ewy ; w < 0
U (w, y) =
b(w)e−wy ; otherwise
Basically ,
U (w, y) = c(w)e−|w|y
where c(w) becomes a(w) when w < 0 and when w > 0 c(w)=b(w).
According to boundary conditions , we can say that
Z ∞
1
U (w, 0) = F|f (x)| = f (x)eiwx dx
2π −∞
Work Contribution :
Module 1 - Equally Contributed
Module 2 -
Module 3 -
Module 4 -