第5次图像处理作业
1. 复习理解课本中最佳陷波滤波器进行图像恢复的过程,请推导出w(x,y)最优解的计算过程.
根据公式:
σ2=1(2a+1)(2b+1)∑∑[g−wη−(gˉ−wηˉ)]2\sigma ^2= \frac{1}{(2a+1)(2b+1)}\sum\sum[g-w\eta - (\bar g-w\bar\eta)]^2σ2=(2a+1)(2b+1)1∑∑[g−wη−(gˉ−wηˉ)]2
∂σ2∂w=2(2a+1)(2b+1)∑∑[g−wη−(gˉ−wηˉ)][−η+ηˉ]=0\frac{\partial \sigma^2}{\partial w}=\frac{2}{(2a+1)(2b+1)}\sum\sum[g-w\eta - (\bar g-w\bar\eta)][-\eta+\bar\eta] = 0∂w∂σ2=(2a+1)(2b+1)2∑∑[g−wη−(gˉ−wηˉ)][−η+ηˉ]=0
∑∑(g−gˉ)(−η+ηˉ)+∑∑w(−η+ηˉ)(−η+ηˉ)=0\sum\sum(g-\bar g)(-\eta+\bar \eta) + \sum\sum w(-\eta+\bar \eta)(-\eta+\bar \eta) =0∑∑(g−gˉ)(−η+ηˉ)+∑∑w(−η+ηˉ)(−η+ηˉ)=0
w=∑∑(g−gˉ)(−η+ηˉ)∑∑(−η+ηˉ)(−η+ηˉ)w=\frac{\sum\sum(g-\bar g)(-\eta+\bar \eta)}{\sum\sum (-\eta+\bar \eta)(-\eta+\bar \eta)}w=∑∑(−η+ηˉ)(−η+ηˉ)∑∑(g−gˉ)(−η+ηˉ)
w=1(2a+1)(2b+1)∑∑(g−gˉ)(−η+ηˉ)1(2a+1)(2b+1)∑∑(−η+ηˉ)(−η+ηˉ)w=\frac{\frac{1}{(2a+1)(2b+1)}\sum\sum(g-\bar g)(-\eta+\bar \eta)}{ \frac{1}{(2a+1)(2b+1)}\sum\sum (-\eta+\bar \eta)(-\eta+\bar \eta)}w=(2a+1)(2b+1)1∑∑(−η+ηˉ)(−η+ηˉ)(2a+1)(2b+1)1∑∑(g−gˉ)(−η+ηˉ)
w=1(2a+1)(2b+1)(∑∑(gηˉ−gˉηˉ)+∑∑(−gη+gˉη))1(2a+1)(2b+1)(∑∑η2+∑∑ηˉ2−2∑∑ηηˉ)w = \frac{\frac{1}{(2a+1)(2b+1)}(\sum\sum(g\bar\eta-\bar g\bar\eta)+\sum\sum(-g\eta+\bar g \eta))}{ \frac{1}{(2a+1)(2b+1)}(\sum\sum \eta^2 +\sum\sum\bar\eta^2-2\sum\sum\eta\bar\eta)}w=(2a+1)(2b+1)1(∑∑η2+∑∑ηˉ2−2∑∑ηηˉ)(2a+1)(2b+1)1(∑∑(gηˉ−gˉηˉ)+∑∑(−gη+gˉη))
根据
1(2a+1)(2b+1)∑∑(gηˉ−gˉηˉ)=0\frac{1}{(2a+1)(2b+1)}\sum\sum(g\bar\eta-\bar g\bar\eta) = 0(2a+1)(2b+1)1∑∑(gηˉ−gˉηˉ)=0
1(2a+1)(2b+1)(∑∑(gηˉ−gˉηˉ)+∑∑(−gη+gˉη))=gnˉ−gˉnˉ\frac{1}{(2a+1)(2b+1)}(\sum\sum(g\bar\eta-\bar g\bar\eta)+\sum\sum(-g\eta+\bar g \eta))={\bar{gn}-\bar g \bar n}(2a+1)(2b+1)1(∑∑(gηˉ−gˉηˉ)+∑∑(−gη+gˉη))=gnˉ−gˉnˉ
1(2a+1)(2b+1)(∑∑ηˉ2−2∑∑ηηˉ)=ηˉ2{ \frac{1}{(2a+1)(2b+1)}(\sum\sum\bar\eta^2-2\sum\sum\eta\bar\eta)}=\bar \eta^2(2a+1)(2b+1)1(∑∑ηˉ2−2∑∑ηηˉ)=ηˉ2
那么
w=gnˉ−gˉnˉη2ˉ−ηˉ2w = \frac{\bar{gn}-\bar g \bar n}{\bar{\eta^2}-\bar \eta ^2}w=η2ˉ−ηˉ2gnˉ−gˉnˉ
2.考虑在x方向均匀加速导致的图像模糊问题。如果图像在t = 0静止,并用均匀加速x0(t) = at2/2加速,对于时间T, 找出模糊函数H(u, v), 可以假设快门开关时间忽略不计。
新图像函数为
g(x,y)=∫0Tf[x−x0(t),y−y0(t)]dtg(x,y)=\int _0 ^T f[x-x_0(t),y-y_0(t)]dtg(x,y)=∫0Tf[x−x0(t),y−y0(t)]dt
G(u,v)=∫∫g(x,y)e−j2π(ux+vy)dxdyG(u,v)=\int\int g(x,y)e^{-j2\pi(ux+vy)}dxdyG(u,v)=∫∫g(x,y)e−j2π(ux+vy)dxdy
=∫∫(∫0Tf[x−x0(t),y−y0(t)]dt)e−j2π(ux+vy)dxdy=\int\int(\int_0^Tf[x-x_0(t),y-y_0(t)]dt)e^{-j2\pi(ux+vy)}dxdy=∫∫(∫0Tf[x−x0(t),y−y0(t)]dt)e−j2π(ux+vy)dxdy
=∫0T(∫∫f[x−x0(t),y−y0(t)]e−j2π(ux+vy)dxdy)dt=\int_0^T(\int \int f[x-x_0(t),y-y_0(t)]e^{-j2\pi(ux+vy)}dxdy)dt=∫0T(∫∫f[x−x0(t),y−y0(t)]e−j2π(ux+vy)dxdy)dt
=∫0TF(u,v)e−j2π(ux0(t)+vy0(t))dt=\int_0^TF(u,v)e^{-j2\pi(ux_0(t)+vy_0(t))}dt=∫0TF(u,v)e−j2π(ux0(t)+vy0(t))dt
=F(u,v)∫0Te−j2π(ux0(t)+vy0(t))dt=F(u,v)\int_0^{T} e^{-j2\pi(ux_0(t)+vy_0(t))}dt=F(u,v)∫0Te−j2π(ux0(t)+vy0(t))dt
因此模糊函数为
H(u,v)=∫0Te−j2π(ux0(t)+vy0(t))dt=∫0Te−jπuat2dtH(u,v)=\int_0^{T} e^{-j2\pi(ux_0(t)+vy_0(t))}dt=\int_0^T e^{-j\pi uat^2}dtH(u,v)=∫0Te−j2π(ux0(t)+vy0(t))dt=∫0Te−jπuat2dt
3.已知一个退化系统的退化函数H(u,v), 以及噪声的均值与方差,请描述如何利用约束最小二乘方算法计算出原图像的估计。
F^(u,v)=[H∗(u,v)∣H(u,v)∣2+γ∣P(u,v)∣2]G(u,v)......∗\widehat{F}(u,v)=[\frac{H^*(u,v)}{|H(u,v)|^2+\gamma |P(u,v)|^2}]G(u,v)......*F(u,v)=[∣H(u,v)∣2+γ∣P(u,v)∣2H∗(u,v)]G(u,v)......∗
设定其残差r=g−Hf^r = g-H\widehat{f}r=g−Hf
应有∣∣r∣∣2=∣∣η∣∣2||r||^2=||\eta||^2∣∣r∣∣2=∣∣η∣∣2
(1)给定γ\gammaγ一个初始值
(2)计算∣∣r∣∣2||r||^2∣∣r∣∣2
(3)若满足∣∣r∣∣2−∣∣η∣∣2||r||^2-||\eta||^2∣∣r∣∣2−∣∣η∣∣2处于某一个精度范围之内则结束,否则更新γ\gammaγ大小,可以采用牛顿法.
(4)使用计算到的γ\gammaγ值代入(∗)(*)(∗)式中计算
(5)通逆傅里叶变换得到图像.
在计算∣∣r∣∣2−∣∣η∣∣2||r||^2-||\eta||^2∣∣r∣∣2−∣∣η∣∣2的时候,其中∣∣η∣∣2||\eta||^2∣∣η∣∣2的计算需要依赖于噪声的方差和均值.
∣∣η∣∣2=MN[σ2−m]||\eta||^2=MN[\sigma^2-m]∣∣η∣∣2=MN[σ2−m]