The output of the inverse kernel of this two-dimensional convolution kernel
This is basically a generalization of the issue - obtaining an inverse filter for the convolution kernel of an image .
Formulation of the problem
For a given convolution kernel $ f \ in \ mathbb {R} ^ {m \ times n} $, find your inverse kernel, $ g \ in \ mathbb {R} ^ {p \ times q} $ for which $ f \ ast g = h = \ delta $.
Decision i
You can build the matrix form of the convolution operator.
The Matrix form can duplicate various image filtering modes (exclusive):
- ( ).
- - $\left (m + p - 1\right)\times\left (n + q - 1\right) $.
("").
- .
, .
Convolution Matrix ( "Same"), .
, , - .
, ( ), .
, , , ( ).
II
:
$$\arg\min_ {g}\frac {1} {2} {\ left\| f\ast g - h\right\|} _ {2} ^ {2} $$
:
$$\frac {\ part\frac {1} {2} {\ left\| f\ast g - h\right\|} _ {2} ^ {2}} {\ g} = f\star\left (f\ast g - h\right) $$
$\star $ - .
full ( MATLAB).
:
hObjFun = @(mG) 0.5 * sum((conv2(mF, mG, 'full') - mH) .^ 2, 'all');
mObjFunGrad = conv2(conv2(mF, mG, 'full') - mH, mF(end:-1:1, end:-1:1), 'valid');
, mF Correaltion valid ( Adjoint/Transpose β output ).
:
for ii = 1:numIteraions
mObjFunGrad = conv2(conv2(mF, mG, 'full') - mH, mF(end:-1:1, end:-1:1), 'valid');
mG = mG - (stepSize * mObjFunGrad);
end
StackOverflow Q2080835 GitHub Repository.