$24
For theory questions, we will arrange a drop box, for coding questions, you need to upload all the codes on backpack and then
subsequently give a demo to TAs.
Q1. Suppose you want to image a circular object which has a diameter of one femtometer, which EM radiation would you
choose for illumination? Why?
[1]
Q2. Suppose a hypothetical person has only one type of cone receptor, let us say which is responsible for viewing red color. In an atypical ambience, the illumination is obtained using a bulb which emits light only in the visible blue spectrum. Can the person
see objects in such a room? Give reasons.
[1]
Q3. Downsampling is a typical operation performed on images, where alternate rows or columns or both may be removed. For example, downsampling by a factor of 2 on both row and column would result in an image of quarter sized output. Will it cause contour effects? Why or why not? [1]
Q4.a. Determine the backward nearest neighbor interpolation of the following 2x2 input image
[4]
Co-ordinates: (1,1) (2,1)
(1,2) (2,2)
Pixel values at the corresponding locations are:
7
9
The interpolation or scaling factor is 2 on both X and Y directions, ie the output image should have 4x4 dimension.
You should show this theoretically as well write a code for obtaining the output image.
Steps:
You should create an input grid, as given in question.
Create an output grid from (1,1) to (4,4)
Use the interpolation factor and divide the output grid by this factor. For example take (3,3). Divide by 2, will give (1.5, 1.5).
You shall obtain all the coordinate values and then determine which is nearest neighbor to these coordinates in the input grid. Closest point to (1.5, 1.5) can be either (1,1) or (2,2). You can choose either, but whichever you choose you shall follow same rule for all the points.
Go to the output grid and place the pixel values obtained in previous step. For example, you choose the nearest neighbor as (2,2), the pixel value there is 9. You can put this value at output grid at (3,3).
Q4.b. Now use the image ‘cameraman.tif’ and write a code to interpolate it by a factor of 2. You can create an output grid of double the image size on both X and Y dimensions. Initialize the output matrix with zeros. Then run a loop to compute the nearest neighbor and plug in the values. A pseudo code is given below. Here I1 is the input and I2 is the output image. A better way would be to use meshgrid and avoid for loop (look for lecture notes/ https://scipython.com/book/chapter-8-scipy/additional-examples/interpolation-of-an-image/). [3]
for x=1:N2 % rows in output
for y=1:M2 % columns in output
Calculate position of output grid oordinates in input grid v = x/cx;
w = y/cy;
We'll just pick the nearest neighbor to (v,w)
v = round(v);
w = round(w);
I2(x,y) = I1(v,w);
end
end