4

与标准(并且更具挑战性)去模糊和超分辨率场景不同,我可以访问原始(清晰)图像G和模糊版本B。我只是在寻找模糊内核h。所以因为B是使用真实相机拍摄的,所以关系是:

B=G*h+N     (其中*表示卷积,N是一些加性噪声)

自然,这是一个过度约束的问题,因为h它的尺寸相对较小,G因此B这对图像中的每几个像素都会在 的条目上生成一个方程h

但实际实现这一点的最简单方法是什么?到目前为止我的想法:

  • 移至频域并进行除法(如this answer所示)。但这不可避免地会因为噪声而在数值上不稳定,对吧?
  • 互相关 - 我只找到了一维信号的示例,无法弄清楚如何在图像的二维情况下使用。
  • 仔细构造一个过约束的线性系统,使用一些优化程序G'h'=B'寻找h' 内核条目的向量版本。h但这非常繁琐,矩阵G'和向量B'的大小势必很大。

从 C++ 到 MATLAB 的任何编程语言的具体示例都将非常有用。

4

1 回答 1

2

使用@Shai 的相关建议,我现在可以给出详细的答案。

我建议的选项 2 和 3 实际上是相同的,并且显然是正确的方法。这也是@Shai 链接的建议论文的 E 步骤中所做的。提出过度约束问题实际上非常简单。

为了正确地提出这些方程,我们使用这样一个事实,即每个块的点积(内核大小以某个像素为中心)G与 180 度旋转版本h应该等于对应的像素 in B。这直接源于这样一个事实,即BG与卷积相关,因此块通过互相关(以及因此 180 度旋转)G与像素相关。B

MATLAB 代码现在变为:

%inputs: B,G - gray level blurred and sharp images respectively (double)
%        szKer - 2 element vector specifying the size of the required kernel
%outputs: mKer - the recovered kernel, 
%         imBsynth - the sharp image convolved with the recovered kernel
%
%example usage:  mKer = calcKer(B, G, [11 11]);

function [mKer, imBsynth] = calcKer(B, G, szKer)

  %get the "valid" pixels from B (i.e. those that do not depend 
  %on zero-padding or a circular assumption
  imBvalid = B(ceil(szKer(1)/2):end-floor(szKer(1)/2), ...
      ceil(szKer(2)/2):end-floor(szKer(2)/2));

  %get a matrix where each row corresponds to a block from G 
  %the size of the kernel
  mGconv = im2col(G, szKer, 'sliding')';

  %solve the over-constrained system using MATLAB's backslash
  %to get a vector version of the cross-correlation kernel
  vXcorrKer = mGconv \ imBvalid(:);

  %reshape and rotate 180 degrees to get the convolution kernel
  mKer = rot90(reshape(vXcorrKer, szKer), 2);

  if (nargout > 1)
      %if there is indeed a convolution relationship between B and G
      %the following will result in an image similar to B
      imBsynth = conv2(G, mKer, 'valid');
  end

end

我还发现在实际场景中可能需要对解决方案进行一些限制。示例是强制内核为正、平滑或对称。合并这些的确切方法超出了这个问题的范围,但在求解 时通常会以线性约束或正则化元素的形式出现vXcorrKer

于 2013-12-29T11:07:00.420 回答