如何从另一个给定图像中恢复图像

问题描述 投票:1回答:1

[如果我有灰度方形图像(1),并且将其副本旋转90度。我创建一个新图像(2),其中像素是原始图像和旋转图像的总和。我的问题是,如果我只有图像2,如何恢复原始图像1?

image image-processing recovery
1个回答
0
投票

简短的答案是:您不能恢复原始图像。

证明:假设2x2图片:

I = [a b]
    [c d]

J = I + rot90(I) = [ a + b, b + d] = [E F
                   [ a + c, c + d]    G H]

现在让我们尝试求解线性方程组:

E = a + b + 0 + 0
F = 0 + b + 0 + d
G = a + 0 + c + 0
H = 0 + 0 + c + d

A = [a, b, 0, 0     u = [a   v = [E
     0, b, 0, d          b        F
     a, 0, c, 0          c        G   
     0, 0, c, d]         d]       H]

v = A*u

为了提取u,矩阵A必须是可分解的。但是det(A) = 0,所以有无限可能的解决方案。


我尝试了一种迭代方法。我在MATLAB中实现了它。

我稍微玩了一下,发现使用双边滤镜并适度锐化可以改善重建结果。可能还有更好的启发式方法,我无法考虑。

这是MATLAB实现:

I = im2double(imread('cameraman.tif'))/2; %Read input sample image and convert to double
J = I + rot90(I); %Sum of I and rotated I.

%Initial guess.
I = ones(size(J))*0.5;

h_fig = figure;
ax = axes(h_fig);
h = imshow(I/2);

alpha = 0.1;
beta = 0.01;

%100000 iterations.
for i = 1:100000
    K = I + rot90(I);
    E = J - K; %E is the error matrix.
    I = I + alpha*E;

    if mod(i, 100) == 0
        if (i < 100000*0.9)
            I = imsharpen(imbilatfilt(I), 'Amount', 0.1);
        end
        h.CData = I*2;
        ax.Title.String = num2str(i);
        pause(0.01);
        beta = beta * 0.99;        
    end
end

I和rot90(I)之和:enter image description here

原始图片:enter image description here

重建图像:enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.