分享

[转]几种常用的假设图像边界条件用于抑制振铃效应及实现(上)

 托尼虎 2021-04-19

一 介绍        

传统的图像复原方法可能会给复原图像引入振铃效应,并且以边界振铃为主;产生这种现象的原因简单地来讲主要是由于模糊核的 不精确或者信息丢失。

[图片来自论文《光学合成孔径系统成像性能优化与分析》P79 魏小峰]

        Renting liu、Jiaya Jia在论文《REDUCING BOUNDARY ARTIFACTS IN IMAGE DECONVOLUTION》中对这种效应的原因进行了解释:

        The convolution operator makes use of not only the image in the Field of View (FOV) of the given observation but also part of the scenery in the area bordering it.Hence, part of the information that is used to produce the filtered image boundary pixels is not available to the deconvolution process. Using the Fast Fourier Transform (FFT), the effect of missing boundary would propagate throughout the image and deteriorate the entire image. This problem is known as the boundary value problem, which poses a difficulty to various image restoration methods.

        大意为在图像模糊的过程中,卷积算子(模糊核)不仅仅利用清晰图像FOV内的信息,也利用了外部边缘的信息。但是获取的图像只是FOV内的图像,FOV外界信息缺失,不能用于反卷积来复原图像,这种信息缺失在整个图像中传播导致了振铃效应。

        同样,Xu Zhou等在《A boundary condition based deconvolution framework for image deblurring》也有类似的解释:

        Since the outside information of FOV is unavailable, some assumptions on the outside values are needed to estimate x. These assumptions are called the boundary conditions.

        Due to lack of boundary information that is used to produce the blurred image, in most cases, it is impossible to estimate an accurate solution from the observation data. The missing boundary values usually cause serious ringing artifacts around the boundary of restored image, and would propagate it throughout the entire image if image boundary is not well treated.

        原文中x表示原始FOV内的图像。 

        假设清晰图像为M*N大小,卷积算子为(2m+1)*(2m+1)大小,在对图像第1~m行、M-m+1到M行、1~m列、N-m+1~N-m行的像素进行卷积的过程中,卷积算子的范围超出了图像的边界,而默认边界外是0,其实有时是不准确的,在观察得到的FOV外存在某些信息参与了模糊过程,因此本文探讨如何估计这些外部边界信息(也即假设边缘条件,或简称BC)来减少复原的振铃效应。如下图所示,黑框内为FOV,蓝色区域为图像临近边界区域,也就是卷积计算时有FOV外像素参与计算的区域,红框为卷积算子,灰色为当前卷积的像素,绿框到黑框范围时需要假设的外部边界信息。

        目前,经典的假设边界条件有zero(Dirichlet)、periodic、reflective(Neumann、symmetric)、anti-reflective,这些BC对于传统非盲复原算法有很好的抑制效果,但对于新的复原算法就不太适用,后来学者相继提出了平滑边界方法[Reducing boundary artifacts in image deconvolution]、基于反卷积框架的边界条件[A boundary condition based deconvoluton framework for image deblurring]、渐进边界假设[基于稀疏正则化和渐近边界假设的运动模糊图像盲复原 ]等。

二 传统边界条件

        以一维信号为例,模糊模型为:

        g表示为模糊信号,f表示为输入的原始信号,h表示模糊核,v表示噪声。

        设f长度为n,h长度为2m+1,则可以表示为:

        f具有两个边界,即左边界fl和有边界fr:

        最后带扩展边界的信号表示为:

         假设边界条件就在于f已知,去假设fl和fr。

        四种传统的边界扩充条件公式如下:

        1.zero(Dirichlet)

        显而易见,边界直接为0.

        2.periodic

        周期边界,相当于多个相同图像拼在一起,之后对某个图像按稍大图像尺寸的大小进行截取。

        3.reflective

        反射边界,相当于以图像边缘线为对称轴进行对称得到。

        4.anti-reflective

        抗反射边界。

四种传统BC的效果图:

 [图源《Antireflective boundary conditions for deblurring problems 》在IPCA2010的ppt]

在二维图像中,几种BC的效果按上述介绍的顺序展示如下:

代码如下:

 

  1. x=rgb2gray(imread('tt.jpg'));
  2. [N1,N2]=size(x);
  3. % [M1,M2]=size(Psf);
  4. M1=127;
  5. M2=127;
  6. m1=(M1-1)/2;
  7. m2=(M1-1)/2;
  8. %zero (DiricChlet) B
  9. %that the signal outside the domain of the observed vector g is ZERO
  10. xe0=zeros(N1+2*m1,N2+2*m2);
  11. xe0(m1+1:m1+N1,m2+1:m2+N2)=x;
  12. %periodic boundary
  13. xep=zeros(N1+2*m1,N2+2*m2);
  14. xep(m1+1:m1+N1,m2+1:m2+N2)=x;
  15. for i=1:m1
  16. xep(i,:)=xep(N1+i,:);
  17. xep(i+m1+N1,:)=xep(m1+i,:);
  18. end
  19. for i=1:m2
  20. xep(:,i)=xep(:,N2+i);
  21. xep(:,i+m2+N2)=xep(:,m2+i);
  22. end
  23. %Neumann BC
  24. xeN=zeros(N1+2*m1,N2+2*m2);
  25. xeN(m1+1:m1+N1,m2+1:m2+N2)=x;
  26. for i=1:m1
  27. xeN(i,:)=xeN(2*m1-i+1,:);
  28. xeN(i+m1+N1,:)=xeN(N1-i+m1+1,:);
  29. end
  30. for i=1:m2
  31. xeN(:,i)=xeN(:,2*m2-i+1);
  32. xeN(:,i+m2+N2)=xeN(:,N2-i+m2+1);
  33. end
  34. %antireflective BC
  35. %f(1-j)=2f(1)-f(1+j)
  36. %f(n+j)=2f(n)-f(n-j)
  37. xea=zeros(N1+2*m1,N2+2*m2);
  38. xea(m1+1:m1+N1,m2+1:m2+N2)=x;
  39. for i=1:m1
  40. xea(m1+1-i,:)=2*xea(m1+1,:)-xea(m1+1+i,:);
  41. xea(i+m1+N1,:)=2*xea(m1+N1,:)-xea(m1+N1-i,:);
  42. end
  43. for i=1:m2
  44. xea(:,m2+1-i)=2*xea(:,m2+1)-xea(:,m2+1+i);
  45. xea(:,i+m2+N2)=2*xea(:,m2+N2)-xea(:,m2+N2-i);
  46. end

Psf表示计算或者导入得到的PSF函数(模糊核,卷积算子)在此只用于边界扩充,不用导入或者计算,直接赋值了其大小M1*M2(必须为奇数,否则m1和m2不是整数)。xe的第m1+1到m1+N1、m2+1:m2+N2列为原图像,其余区域为外部边界区域。最后xe0、xep、xeN、xea为各种BC的图像,其中xea由于计算中出现赋值,需要归一化(但是中间图像的灰度会变低)或者转为uint8格式(小于0的变为0,大于255的变为255)。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多