You are on page 1of 5

SI Sheet 1 Sol.

Correcting & Registering Images

1) For a particular application suppose it was necessary to apply geometric correction


procedures to an image prior to classification. What interpolation technique would
you prefer to use in the resampling process? Why?

Solution

Recall, that we had three interpolation techniques as follows


Nearest Neighbor Resampling Bilinear Interpolation Cubic Interpolation
Compute the distance to the nearest 4 pixel-centers distance to the nearest 16 pixel-centers
Use the BV of the nearest pixel 1
Apply weighted (𝑤𝑖 = 𝑑2 )
1
Apply weighted (𝑤𝑖 = 𝑑2 ) average on the
𝑖 𝑖

average on the 4 BVs → new BV 16 BVs→ new BV

Nearest neighbor resampling is the best in this case as accurate colors are needed for
classification (e.g., of land cover such as vegetation) and it does not create new colors by
taking the nearest. Meanwhile, bilinear and cubic interpolation create new colors in the
process of interpolation by averaging.

Note that on the other hand, if the new image has a very different pixel size (much larger)
then not creating new colors make the image blocky (to much pixel replication). Meanwhile,
bilinear and cubic interpolation result in a smooth image due to averaging.

2) In a particular problem you have to register five images to a map. Would you
register each image to the map separately (1), register one image to the map and
then the other four images to that one (2), or image 1 to the map, image 2 to image
1, image 3 to image 2 etc. (3)?

Solution

In each of the three cases we do 5 registrations. However, in the first option we register
each to the map which would be the most accurate. Option (3) is the least accurate as a
lot of error will accumulate and option (2) is just less accurate.
3) Locate the bad pixels and correct them in the following
170 238 85 255 221 200
68 136 17 170 1119 68
221 0 238 136 0 255
119 255 85 170 136 238
238 17 221 68 119 255
85 170 119 221 17 136

Solution

For each bad pixel (located above) apply the correction formula

∑8𝑝=1 𝐵𝑉𝑝
𝐵𝑉 = 𝐼𝑛𝑡( )
8
A way to handle the border pixels should be specified if needed in the exam and in general
you need to set a threshold for the number of bad neighboring pixels and only correct if
there are less neighbors.

4) Consider the following table that shows the average RMS error at the proposed
number of GCPs and order of polynomial

Explain why some cells are empty


Solution

Recall that a first-order polynomial took the form


𝑓(𝑥, 𝑦) = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑦
𝑔(𝑥, 𝑦) = 𝑏0 + 𝑏1 𝑥 + 𝑏2 𝑦
and thus required at least 3 points (GCPs) to find the coefficients by solving equations or
least squares. For a 2nd degree polynomial, we would’ve needed 𝑥 2 , 𝑦 2 , 𝑥𝑦 so that’s three
more terms then for a 3rd degree polynomial we also need 𝑥 3 , 𝑦 3 , 𝑥 2 𝑦, 𝑥𝑦 2 (four more terms);
it can be observed that there is one more option for the 𝑥 𝑎 𝑦 𝑏 term every time the degree
increases by one.

Thus, the minimum number of GCPs (also the number of coefficients) for polynomials of
degrees 1st to 5th are
0th 1st 2nd 3rd 4th 5th
1 1+2 3+3 6+4 10+5 15+6

Whenever a cell was empty above, it was true that the number of GCPs was less than the
number of minimums needed for least squares.

5) Consider the following portion of an image to be


rectified, it is required to determine the brightness value
for the pixel that happened to be mapped to the
following co-ordinates on the original image:
(𝒚’ = 𝟔𝟏𝟗. 𝟕𝟏, 𝒙’ = 𝟒𝟗𝟑. 𝟑𝟗)
Solution

The original image does not have a pixel (𝑥 ′ = 493.39, 𝑦 ′ = 619.71) to get the BV
from and thus, we would like to interpolate to get the BV. We will do nearest
neighbor resampling and bilinear interpolation.

First identify the four nearest pixels and the distance from (493.39,619.71) to
each. In other words, calc for each of the following (𝑥 − 493.39)2 + (𝑦 − 619.71)2
Pixel Center BV Square Distance (𝒅𝟐𝒊 ) (𝟏/𝒅𝟐𝒊 )
(493, 619) 62 0.656 1.524
(493, 620) 56 0.236 4.237
(494, 619) 68 0.876 1.14
(494, 620) 59 0.456 2.19

• Nearest Neighbor
o Use 𝐵𝑉 = 56 (nearest)
• Bilinear Interpolation
62∗1.524+56∗4.237+68∗1.14+59∗2.19
o Use 𝐵𝑉 = 59 = 𝐼𝑛𝑡 ( 1.524+4.237+1.14+2.19
) = 59

6) If the following 𝟐 ∗ 𝟐 image is to be scaled with factors (2,2)

1 2
10 20 1
30 40 2

a. Do all pixels in the resulting image require interpolation to compute their


brightness values? Why?
b. If your answer in a is No, sketch the new scaled image showing the rows and
columns numbers with filling the pixel values that won’t require interpolation.

Solution

Yes, it will require interpolation. The (2,2) image has 4 pixels and the scaled (4,4) image
has 16 pixels so for) 12 pixels (at least generally) we will need to interpolate to provide a
pixel value.

Let’s scale the image, to do so we will prepare a display grid of size (4,4) since we expect
the result to be of that size

1 2 3 4
1
2
3
4

The mapping function in this case due to the scale factor is


𝑥 𝑦
𝑥 ′ = 𝑓(𝑥, 𝑦) = and 𝑦 ′ = 𝑔(𝑥, 𝑦) = 2
2

And the only display grid pixels (𝑥, 𝑦) that will map directly are
(𝑥, 𝑦) (2,2) (2,4) (4,2) (4,4)
(𝑥 ′ , 𝑦 ′ ) (1,1) (1,2) (2,1) (2,2)

Other display grid pixels such as (3,3) will map to (1.5,1.5) which doesn’t exist so
we will need interpolation.

This implies coloring such pixels as (from the original image)

1 2 3 4
1
2 10 20

3
30 40
4

And interpolating the rest.

7) If a detector records spectral measurements that are 50 brightness values


greater than the other detectors for the same band.
a. Mention what will happen in the resulting image.
b. Mention a solution.
Solution

Let’s recap on instrumentation radiometric errors


Random Bad Pixels Line Drop-outs Line Stripping
Lines in the image being
Random pixel(s) take value 0 Lines in the image with no
systematically brighter or
or 255 spectral information
darker that adjacent lines
Problem with individual Linear detector failed Linear detector is out of
detector units (temporarily or forever) radiometric adjustment

Clearly, the case we have is line stripping and what will happen is as described in
the table. The solution to this is called d-stripping and can be done in one of two
ways:

• First Method:
1. For each detector compute a histogram (optional)
2. Compute the detector scan-line average (or median) for each detector

3. If any of the detector averages is too low compared to the others

▪ Assume all of its lines are damaged and correct them by adding or subtracting
bias (or even multiply by gain if needed)

• Second Method:
1. Choose one of the detectors as a standard (the one least likely to ever fail)
2. Compute its 𝜇𝑑 and 𝜎𝑑 (using the averages of its scan-lines)

3. For each other detector

o Compute its own 𝜇𝑖 and 𝜎𝑑

o For each of its scan-lines

▪ Transform the pixel values for it such that the mean and standard deviation
become 𝜇𝑑 and 𝜎𝑑 from 𝜇𝑖 and 𝜎𝑖 using

𝑥 − 𝜇𝑖
𝑥𝑛𝑒𝑤 = × 𝜎𝑑 + 𝜇𝑑
𝜎𝑖

You might also like