Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

CS 663: Fundamentals of Digital Image Processing:

Mid-Sem Examination
Instructor : Suyash P. Awate

The Exam is: Closed Notes. Closed Books. NO cheat sheet. Closed internet.
Closed everything.

Roll Number: ________________ Name: _______________________________________________

When in doubt regarding a question, make suitable assumptions that go minimally against what is
mentioned in the question, state your assumptions clearly, and solve the question.
All the very best!

Cheat Sheet:

Convolution: Given two functions f (x) and g(x), their convolution is given by:
Z ∞
(f ∗ g)(y) := f (x)g(y − x)dx
x=−∞

Fourier Transform: For a function f (x) on the spatial domain, the Fourier transform is:
Z ∞
F f (w) := f (x)e−iwx dx
x=−∞

Inverse Fourier Transform: For a function g(w) on the frequency domain, the inverse Fourier
transform is:
Z ∞
−1 1
F g(x) := g(w)eiwx dw
2π w=−∞

2 2
Fourier Transform of a Gaussian: For a function g(x) := √1 e−x /(2σ ) , where σ > 0,
σ 2π

2 σ 2 /2
F g(w) = e−w

Convolution and Fourier Transform:

F (f ∗ g)(w) = (F f · F g)(w)

1
1. [5 points]
Consider a grayscale image that stores scalar intensities using a 3-bit integer format, with
intensities ranging from 1 to 8. For this image, let the histogram indicate the probabilities at
each intensity, from 1 to 8, as follows: 0.10, 0.05, 0.20, 0.25, 0.05, 0.15, 0.15, 0.05.
• (a) (1 points) Calculate the intensity-transformation function mapping, from R 7→ R under-
lying histogram equalization.
• (b) (4 points) Assuming that the output image needs to be stored in the same 3-bit data
format as the input image, calculate the histogram for the output image.

2
2. [5 points]
• (a) (2 points) Consider a vector-valued image g that stores, at each spatial location (x, y),
2-dimensional vectors (g1 (x, y), g2 (x, y)).
At any spatial location (x, y), let the image contain the vector (g1 (x, y), g2 (x, y)) = (1, 0).
Consider another vector-valued image f such that f1 (x, y) and f2 (x, y)) are obtained by
rotating each of the two scalar-valued images g1 (x, y) and g2 (x, y) by 90 degrees counter-
clockwise around the origin (0, 0).
Derive the vector values in the image f at spatial locations (x, y) where x = 0 and y takes
non-negative values.
• (b) (3 points) Consider a vector-valued image that stores, at each spatial location (x, y),
2-dimensional vectors (a1 (x, y), a2 (x,py)) whose (i) direction is along with the vector from the
origin (0, 0) to (x, y) and (ii) norm is x2 + y 2 .
Consider another vector-valued image b such that b1 (x, y) and b2 (x, y) are obtained by rotat-
ing each of the two scalar-valued images a1 (x, y) and a2 (x, y) by 90 degrees counterclock-
wise around the origin (0, 0).
Derive the vector values in the image b at spatial locations (x, y), where x = 0 and y takes
non-negative values.

3
3. [5 points]
Consider the main motivation underlying the cross bilateral filter for the specific application
covered in class, i.e., denoising an image (say, f (x, y)) taken in an insufficiently lit, but natu-
rally lit, scene by leveraging another image (say, g(x, y)) of the same scene that is brightly lit
with artificial lighting.
With the same motivation in mind, extend the standard patch-based filter (as covered in
class) to a cross patch-based filter. State an algorithm and clearly describe the underlying
logic/motivation.

4
4. [5 points]
Consider an image of a chessboard, on a continuous 2D X –Y domain, where each black
square and each white square is of width 1 unit.
Let location (0, 0) be the center of the chessboard. Let one of the white squares in the
chessboard be the unit square with the vertices at locations (0, 0), (1, 0), (0, 1), and (1, 1).
Consider the spatial location (x = 0, y = 0.5).
Suppose you compute Harris’s corner-ness measure with just a tiny bit of Gaussian smooth-
ing (standard deviation 0.02) on the chessboard image so as to eliminate any jump disconti-
nuities in the image.
• (a) (2 points) If the patch size used during the computation of Harris’s corner-ness measure
is of size 0.2×0.2 unit2 , then will (x = 0, y = 0.5) lead to a high positive value of corner-ness?
Justify theoretically.
• (b) (3 points) If the patch size used during the computation of Harris’s corner-ness measure
is of size 3 × 3 unit2 , then can (x = 0, y = 0.5) lead to a high positive value of corner-ness?
Justify theoretically.

5
5. [10 points]
Consider an image defined on the discrete X –Y spatial domain where the pixel-location
ordinates take integer values.
Suppose you and your friend both decide to implement bilinear interpolation by performing a
sequence of suitably-chosen 1D linear interoplations.
Suppose you first perform all 1D linear interpolation(s) along the X axis and then perform all
1D linear interpolation(s) along the Y axis.
Suppose your friend first performs all 1D linear interpolation(s) along the Y axis and then
performs all 1D linear interpolation(s) along the X axis.
Prove that you and your friend will both get the same answer for any blilinear interpolation
problem.

6
6. [10 points]
Consider the task of computing the structure tensor A at some spatial location (s, t) in the
image. For the image, let g(x, y) be the gradient vector at location (x, y) in the neighborhood
of (s, t).
• (a) (1 point) Write the equation for computing the structure tensor A.
• (b) (3 points) Consider that the image is noiseless/uncorrupted and the gradients g(x, y) in
the neighborhood of (s, t) (i.e., within a patch around (s, t)) are all equal to, say, v . What will
be the eigenvectors (unit-norm) and the eigenvalues of the structure tensor A? Derive and
justify theoretically.
• (c) (6 points) Consider that the previous image is now corrupted by i.i.d. noise (not neces-
sarily Gaussian) that has mean zero and variance α. If the size of the patch is very large,
what will be a good estimate for the (unit-norm) eigenvectors and the eigenvalues of the
structure tensor A? Derive and justify theoretically.

7
7. [10 points]
Consider a 1D image f (x) on a continuous real domain, where f (x) := exp(x)/(1 + exp(x))
is a sigmoid function such that the function values are:
(i) nearly 0 for x < (−6) and
(ii) nearly +1 for x > (+6).
• (a) (2 points) Draw the function f (x), and its derivative function f 0 (x) := ∂f∂x(x) . Draw
f (x) and f 0 (x) either on the same plot, or on two plots one below the other with a clear
correspondence illustrated between the x locations in each plot. Focus on the domain x ∈
[−7, +7].
• (b) (3 points) Give a mathematical formula for a suitable function c(x) that can be used for
Perona-Malik’s anisotropic diffusion. Draw the function c(x) along with f (x) and f 0 (x).

• (c) (2 points) Expand [ ∂x ] · [c(x)f 0 (x)] in terms of the functions f (x) and c(x) and their first
and second derivatives only (no other terms are allowed).
• (d) (3 points) In the expansion above, analyze the signs of each additive term within x ∈
[−7, 0] and x ∈ [0, +7]. Provide some arguments towards how the anisotropic diffusion
formulation differs from the isotropic diffusion (standard Heat equation) formulation, and how
the former can lead to better edge preservation compared to the latter.

8
8. [10 points]
A typical digital image samples the values of a function, say, f (x) at locations x ∈ R2 belong-
ing to a Cartesian grid or a regular rectilinear grid. Instead of the typical situation, consider
an image where the values are sampled at the vertices of a grid where (i) each grid element
is a triangle (instead of being a square or rectangle), and (ii) the triangles underlying the grid
can be of varying shapes and sizes.

Figure 1: An example grid.

Describe an (implementable) algorithm for performing interpolation at any spatial location


within such a grid (i.e., within the shaded area in the picture) such that ALL of the following
hold:
(i) the interpolating function fb(·) across the grid is continuous (e.g., without any jump discon-
tinuity),
(ii) the interpolating-function fb(·) value at any grid vertex is the same as the sampled function
f (·) value at that vertex,
(iii) the interpolated value at location x depends only on the sampled function f (·) values at
the vertices of the triangle within which x lies,
(iv) the interpolating-function fb(·) value at a location x on the edge of a triangle depends only
on the values of the sampled function f (·) at the vertices associated with that edge.

9
9. [20 points]
Consider a digital image f on a 1D spatial domain with N pixels and real-valued pixel in-
tensities. Let fi ∈ R be the intensity of the i-th pixel. Consider a convolution
PM operation on
the image f , using a 1D real-valued kernel k , with M pixels, such that i=1 |ki | = 1. The
convolution implements a zero boundary condition.
• (a) (6 points) For any given (general)
PN kernel k , state an (implementable) algorithm to com-
pute an input image f , having i=1 (fi )2 = 1, such that the convolved image g := f ∗ k is
proportional to the input image f , i.e., ∀i, gi = αfi , where α is any finite non-zero scalar.
• (b) (4 points) For any given (general)
PN kernel k , state an (implementable) algorithm to in-
2
dicate if an input image f , having i=1 (fi ) = 1, exists such that the convolved image
g := f ∗ k has all pixel values as zero (upto floating-point precision). When such an image f
exists, state an (implementable) algorithm to find that f .
• (c) (3 points) Consider an image f with N = 5 pixels. Consider a kernel k with M = 3
pixels, which models a box filter over a 3-neighborhood
PN (i.e., left pixel, center pixel, right
pixel). Find a specific input image f , having i=1 (fi )2 = 1, such that the convolved image
has all pixel values as exactly zero.
• (d) (2 points) Solve the previous question (i.e., (c)) when the kernel implements a cropped
boundary condition.
• (e) (5 points) Solve the questions in (a) and (b) when the image f and the kernel k are both
defined on a 2D spatial domain.

10

You might also like