
Homework #4
Turn in the problems marked with a (*).
1. (*) Calculate the sum of
(fi+1,j âfi,j)2+ (fi,j +1 âfi,j)2
for i= 0, . . . , width â2 and j= 0, . . . , heightâ2 at the end of your averaging inpainter.
Then inpaint âpic5.bmpâ with mask âmask1.bmpâ running for steps 0,20,40,60,80,100.
Write down the value of the sum for each case and turn that it.
2. (*) Use the median in 3 Ă3 squares to inpaint the image âpic4.bmpâ with the mask
whose (i, j)th pixel value is 0 if ior jis odd and 1 otherwise. Take initial guess 0.5
for the missing values and inpaint the image for 100 steps using periodic boundary
conditions.
3. (*) Use the median in 3 Ă3 squares to inpaint the image âpic5.bmpâ with the mask
âmask1.bmpâ. Take initial guess 0.5 for the missing values and inpaint the image for
100 steps using Neumann boundary conditions. Print out your result and turn it in.
4. Form the image in [0,1]Ă[0,1] that has value 0.75 everywhere. Also form the mask in
[0,1] Ă[0,1] that has value 0 in [0.25,0.75] Ă[0.25,0.75] and value 1 otherwise. Using
initial guess 0.5 for the missing values, inpaint the image with 500 steps of 3Ă3 median
inpainting.
5. Use the median in 5 Ă5 squares to inpaint the image âpic5.bmpâ with the mask
âmask1.bmpâ. Take initial guess 0.5 for the missing values and inpaint the image for
100 using Neumann boundary conditions. Print out your result and turn it in.
6. (*) Download âpic6.bmpâ and add salt and pepper noise at each pixel with probability
0.2 for black, 0.2 for white, and 0.6 for no change. Print out the picture and turn it in.
7. Add salt and pepper noise to âpic6.bmpâ at each pixel with probability 0.4 for black,
0.4 for white, and 0.2 for no change. Print out the picture and turn it in.
1