CSED551 –HOMEWORK 4 solved

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

.
NON-BLIND DECONVOLUTION
Image deblurring is a long-standing image restoration problem in computer vision and image processing. Most
classical image deblurring methods model blur using a convolution operation. Specifically, they model a blurred image
𝑏 as:
𝑏 = π‘˜ βˆ— 𝑙 + 𝑛
where π‘˜ is a blur kernel or a point spread function (PSF), 𝑙 is a latent sharp image, and 𝑛 is additive noise, which
is often assumed to be white Gaussian such that 𝑛~𝑁(0, 𝜎
2
) where `white’ noise means the noise variance is constant
for all frequency bands as will be explained later. * is the convolution operator. Then, image deblurring becomes a
deconvolution problem, in which we invert the convolution operation. If we know both 𝑏 and π‘˜, the problem is
called non-blind deconvolution. On the other hand, if we know only 𝑏, the problem is called blind deconvolution.
Non-blind deconvolution serves as a fundamental building block in many applications, e.g., removing motion blur,
out-of-focus blur, and chromatic aberration.
INVERSE FILTERING
The most naΓ―ve approach to non-blind deconvolution is the inverse filtering. We can derive the inverse filtering by
applying the Fourier transform to the blur model above. Specifically, we can obtain:
𝐡 = 𝐾 βŠ— 𝐿 + 𝑁
where 𝐡 is the Fourier transform of 𝑏, i.e., 𝐡 = β„±(𝑏) where β„± represents the forward Fourier transform function.
𝐾, 𝐿, and 𝑁 are also the Fourier transforms of π‘˜, 𝑙, and 𝑛, respectively. βŠ— is the element-wise multiplication
operator. Ignoring noise 𝑁, we can obtain 𝐿 as:
𝐿 β‰ˆ
𝐡
𝐾
where 𝐡
𝐾
is the pixel-wise division between 𝐡 and 𝐾 in the frequency domain. Then, by computing the inverse
Fourier transform, we can obtain a deconvolution result. As this technique directly applies the inverse of a blur kernel
π‘˜ to the input blurred image 𝑏 in the frequency domain, it is called the inverse filtering.
The inverse filtering, however, cannot produce satisfying results. The blur kernel 𝐾 in the frequency domain may
have elements whose values are zero or close to zero, and dividing 𝐡 with such elements leads to totally corrupted
images with significantly amplified noise. To overcome this issue, we need proper handling of noise and regularization.
WIENER DECONVOLUTION
One classical approach to non-blind deconvolution is the wiener deconvolution. The wiener deconvolution is derived
by minimizing the expected error in the frequency domain. Specifically, we want to find a deconvolution filter 𝐻 in
the frequency domain such that
min
𝐻
𝐸[‖𝐿 βˆ’π»π΅β€–
2
]
where 𝐻𝐡 is the pixel-wise multiplication between 𝐻 and 𝐡 in the frequency domain. By solving the equation
above, we can obtain a deconvolution filter 𝐻 such that 𝐻𝐡 is a deconvolution result with the least expected squared
error.
By replacing 𝐡 in the equation above with 𝐡 = 𝐾𝐿 + 𝑁, we can obtain:
min
𝐻
𝐸[‖𝐿 βˆ’ 𝐻(𝐾𝐿 +𝑁)β€–] = min
𝐻
𝐸[β€–(1 βˆ’π»πΎ)𝐿 βˆ’ 𝐻𝑁‖]
Then, we can extend the squares and obtain:
min
𝐻
𝐸[β€–(1 βˆ’ 𝐻𝐾)𝐿 βˆ’ 𝐻𝑁‖] = min
𝐻
{β€–1 βˆ’π»πΎβ€–
2𝐸[‖𝐿‖
2
] βˆ’2(1 βˆ’ 𝐻𝐾)𝐸[𝐿𝑁] + ‖𝐻‖
2𝐸[‖𝑁‖
2
]}
To further continue the derivation, we assume that noise 𝑁 is zero-mean Gaussian noise, which is independent to 𝐿
(in practice, it’s not, but many image restoration works use this assumption to simplify their problems.). Then
𝐸[𝐿𝑁] = 𝐸[𝐿]𝐸[𝑁]. As 𝑁 is zero-mean, 𝐸[𝑁] = 0. As a result, we obtain:
min
𝐻
{β€–1 βˆ’ 𝐻𝐾‖
2𝐸[‖𝐿‖
2
] +‖𝐻‖
2𝐸[‖𝑁‖
2
]}
By differentiating the equation above with respect to 𝐻, and setting it to zero, we can solve the equation for 𝐻:
β‡’ βˆ’2(1 βˆ’ 𝐻𝐾)𝐸[‖𝐿‖
2
]+ 2𝐻𝐸[‖𝑁‖
2
] = 0
β‡’ 𝐻 =
𝐾𝐸[‖𝐿‖
2
]
𝐾2𝐸[‖𝐿‖
2]+ 𝐸[‖𝑁‖
2]
=
𝐾
2
𝐾2 +
𝐸[‖𝑁‖
2]
𝐸[‖𝐿‖
2]
β‹…
1
𝐾
Finally, multiplying 𝐻 to 𝐡, we can obtain the formulation of the wiener deconvolution:
𝑙 = β„±
βˆ’1 (
|β„±(π‘˜)|
2
|β„±(π‘˜)|
2 +
1
𝑆𝑁𝑅(πœ”)
β‹…
β„±(𝑏)
β„±(π‘˜)
)
where all the multiplication and division operations are pixel-wise operations. 𝑆𝑁𝑅(πœ”) is the signal-to-noise ratio at
each frequency πœ”, which is required to be estimated. 𝑆𝑁𝑅(πœ”) is defined as:
𝑆𝑁𝑅(πœ”) =
π‘ π‘–π‘”π‘›π‘Žπ‘™ π‘£π‘Žπ‘Ÿπ‘–π‘Žπ‘›π‘π‘’ π‘Žπ‘‘ πœ”
π‘›π‘œπ‘–π‘ π‘’ π‘£π‘Žπ‘Ÿπ‘–π‘Žπ‘›π‘π‘’ π‘Žπ‘‘ πœ”
Natural images tend to have signal variance that scales as 1
πœ”2
. Noise variance tends to be a constant, i.e., πœŽπ‘(πœ”) =
π‘π‘œπ‘›π‘ π‘‘π‘Žπ‘›π‘‘ for all πœ”. This is called white noise. As a result, we can assume
𝑆𝑁𝑅(πœ”) =
1
π‘πœ”2
and obtain a simplified version of the wiener deconvolution as:
𝑙 = β„±
βˆ’1 (
|β„±(π‘˜)|
2
|β„±(π‘˜)|
2 + π‘πœ”2
β‹…
β„±(𝑏)
β„±(π‘˜)
)
where 𝑐 is a constant. In practice, a more simplified version is often used, which is defined as:
𝑙 = β„±
βˆ’1 (
|β„±(π‘˜)|
2
|β„±(π‘˜)|
2 + 𝑐
β‹…
β„±(𝑏)
β„±(π‘˜)
)
(1)
By setting 𝑐 = 0, the equation above reduces to the inverse filtering. In this homework, you need to implement this
simplified version of the wiener deconvolution. You also need to discuss the effect of the parameter 𝑐 with example
images.
TOTAL-VARIATION (TV) DECONVOLUTION
Non-blind deconvolution is an ill-posed problem. Due to the loss of information caused by the noise 𝑛, even if we
know π‘˜, there can be an infinite number of solutions for 𝑙. To resolve such ill-posedness, most methods adopt a
regularization term or a prior on the latent image 𝑙. One of the most widely-used prior is the total variation, which is
defined as:
𝐸TV(𝑙) = β€–βˆ‚x βˆ— 𝑙‖1 +β€–βˆ‚y βˆ— 𝑙‖
1
where ‖𝑓‖1
is the 𝐿1 norm of an image 𝑓 which is defined as:
‖𝑓‖1 = βˆ‘|𝑓(π‘₯, 𝑦)|
π‘₯,𝑦
and βˆ‚x and βˆ‚y are partial derivative filters along the x- and y-axes, e.g., βˆ‚x = [0,βˆ’1,1] and βˆ‚y = [0,βˆ’1,1]
T
. With
the prior 𝐸TV(𝑙), we can define an energy function for non-blind deconvolution as:
𝐸(𝑙) = ‖𝑏 βˆ’ π‘˜ βˆ— 𝑙‖
2 + 𝛼𝐸TV(𝑙)
where 𝛼 is a parameter to control the strength of the regularization term.
You can also formulate the non-blind deconvolution problem as a maximum-a-posteriori estimation problem, and
derive the energy function above from the MAP formulation. Specifically, you can define a posterior distribution:
𝑝(𝑙|𝑏, π‘˜) ∝ 𝑝(𝑏|𝑙, π‘˜)𝑝(𝑙)
where 𝑝(𝑏|𝑙, π‘˜) is a likelihood, and 𝑝(𝑙) is a prior distribution.
Optimization
The regularization term 𝐸TV(𝑙) in the energy function 𝐸(𝑙) is a non-quadratic term, so the optimization of 𝐸(𝑙)
needs a non-linear optimization algorithm such as the iterative reweighted least-squares (IRLS) method, which is
explained in the course material (see 15.global_optimization.pdf). At each iteration of the IRLS method, you need to
solve a least-squares problem, which is formulated as:
π₯
βˆ— = arg min
π₯
{‖𝐛 βˆ’πŠπ₯β€–
2 + 𝛼(π₯
T𝐃π‘₯
T𝐖π‘₯𝐃π‘₯π₯+ π₯
T𝐃𝑦
T𝐖𝑦𝐃𝑦π₯)}
where 𝐛 and π₯ are vector representations of 𝑏 and 𝑙, respectively. 𝐊 is a matrix representing the convolution
operation with π‘˜. The equation above can be re-written as:
π₯
βˆ— = arg min
π₯
{π₯
T𝐊
T𝐊π₯ βˆ’2π₯
T𝐊
T𝐛 + 𝐛
T𝐛 + 𝛼(π₯
T𝐃π‘₯
T𝐖π‘₯𝐃π‘₯π₯+ π₯
T𝐃𝑦
T𝐖𝑦𝐃𝑦π₯)}
As the right-hand side of this equation is a quadratic function with respect to π₯, its solution can be found by setting its
derivative to zero. Specifically, the derivative of the right-hand side is derived as:
2𝐊
T𝐊π₯βˆ’ 2𝐊
T𝐛 +2𝛼(𝐃π‘₯
T𝐖π‘₯𝐃π‘₯ + 𝐃𝑦
T𝐖𝑦𝐃𝑦)π₯
By setting the derivative to zero, we can derive the following equation:
(𝐊
T𝐊 + 2𝛼(𝐃π‘₯
T𝐖π‘₯𝐃π‘₯ + 𝐃𝑦
T𝐖𝑦𝐃𝑦)) π₯ = 𝐊
T𝐛
Note that this equation has the same form as 𝐀𝐱 = 𝐛, which means that you can find a solution π₯ using a linear solver.
However, the size of the matrix (𝐊
T𝐊+ 2𝛼(𝐃π‘₯
T𝐖π‘₯𝐃π‘₯ +𝐃𝑦
T𝐖𝑦𝐃𝑦)) is huge, so it is hard to directly solve the linear
system. Instead, you can use an iterative solver such as the conjugate gradient method. For more details, refer to the
reference code that is provided with this homework document.
REQUIREMENTS
In this homework, you need to implement two non-blind deconvolution algorithms that remove blur from a given
blurred image 𝑏 and a blur kernel π‘˜. Specifically, you are required to:
⚫ Wiener deconvolution
β—Ό Implement the wiener deconvolution according to Equation (1).
β—Ό Discuss the effect of the parameter 𝑐 with example images.
⚫ TV deconvolution
β—Ό Formulate the non-blind deconvolution problem as a maximum-a-posteriori (MAP) problem, and
derive the energy function 𝐸(𝑙) described above.
β—Ό Explain the relationship between the MAP formulation, and the energy function. Specifically, you need
to explain how 𝛼 can be derived from your MAP formulation.
β—Ό You need to implement an algorithm to optimize the energy function. The energy function above
involves 𝐸TV(𝑙), which is non-quadratic. Thus, you need to implement a non-linear optimization
algorithm. In this homework, you can implement the iterative-reweighted-least-squares (IRLS) method,
which was presented in our course material. See the file ’15.global_optimization.pdf’.
The IRLS optimization for non-blind deconvolution needs to compute convolution operations with a blur kernel
several times, which can take an excessive amount of computation time for large blur kernels. To accelerate the
computation, you can use the convolution theorem.
Your report must include:
⚫ Derivation of the energy function from the MAP formulation and discussion about their relationship
⚫ Detailed discussion on your implementation of the wiener deconvolution and TV deconvolution
⚫ Your results with a detailed discussion including the discussion on the parameter 𝑐 of the wiener
deconvolution
⚫ Limitations of the techniques that you found
You must upload a single zip file that contains the following to the LMS:
⚫ code/ – a directory containing all your code for this assignment
⚫ images/ – a directory containing your input images and their results
⚫ report.pdf – your report as a PDF file
Due: Dec. 19
th, 23:59
Penalty for late submission
⚫ 1 day: 70%
⚫ 2 days: 30%
⚫ 3 days: 0%
RUBRIC
⚫ 30 pts: wiener deconvolution
⚫ 20 pts: Energy function derivation for the TV deconvolution
⚫ 30 pts: Implementation of the TV deconvolution
⚫ 20 pts: Report
Your homework will be scored based on your report, and I am not going to compile or run your code. Thus, your
report must include all necessary details of your implementation and results.