how to deconvolute a matrix?

41 ビュー (過去 30 日間)
Rabih Sokhen
Rabih Sokhen 2022 年 2 月 4 日
コメント済み: Walter Roberson 2022 年 2 月 8 日
hy guys,
i would like to deconvolute a matrix but i didn't find a 2d deconvolution function , any idea how to do that without using fft or ifft?
thank you in advance
code:
clear all
clc
a=randi(2,3)
b=randi(2,3)
c=conv2(a,b)
% [d,r]=deconv2(c,a) this is what i would like to get
subplot(221)
img(a)
subplot(222)
img(b)
subplot(223)
img(c)
subplot(224)
img(d)

採用された回答

Matt J
Matt J 2022 年 2 月 4 日
Using
a=randi(2,3);
b=randi(2,3)
b = 3×3
2 1 2 2 2 1 2 1 1
c=conv2(a,b);
M=func2mat(@(x) conv2(a,x), zeros(3));
b_recon=reshape(M\c(:), 3,3)
b_recon = 3×3
2.0000 1.0000 2.0000 2.0000 2.0000 1.0000 2.0000 1.0000 1.0000
  14 件のコメント
Matt J
Matt J 2022 年 2 月 8 日
編集済み: Matt J 2022 年 2 月 8 日
By generating c in a completely random manner c=rand(2*n-1,2*m-1), there is no gaurantee that it is the result of a convolution. The solution you are getting with M_a\c(:) is, however, the best estimate for b in the least squares sense.
Rabih Sokhen
Rabih Sokhen 2022 年 2 月 8 日
I really appreciate your help.
Thanks you a lot

サインインしてコメントする。

その他の回答 (2 件)

Matt J
Matt J 2022 年 2 月 8 日
編集済み: Matt J 2022 年 2 月 8 日
I would like to deconvolute a matrix but i didn't find a 2d deconvolution function.
See deconvreg(), deconvlucy(), deconvblind(), and deconvwnr().

Walter Roberson
Walter Roberson 2022 年 2 月 8 日
編集済み: Walter Roberson 2022 年 2 月 8 日
https://www.mathworks.com/matlabcentral/answers/1620780-convolve-text-with-image#comment_1953810 shows an implementation for the case of it really only being 1d convolution
  2 件のコメント
Rabih Sokhen
Rabih Sokhen 2022 年 2 月 8 日
hy Walter , hope your doing well
I have seen your link, I don't have a strong background in Matlab, I have understood the global idea of it but not the entire script.
Matt already helped me alot and he did wrote me a great function, however i still have same error wen i try to deconvolute a array as in the folowing exemlple:
can you modify my code if that's possible?
code:
clear all
clc
a=rand(10,3);
b=rand(10,3);
[m,n]=size(a);
M=func2mat(@(x) conv2(a,x), zeros(m,n) );
c=reshape(M\b(:), m,n);
error
Error using \
Matrix dimensions must agree.
Walter Roberson
Walter Roberson 2022 年 2 月 8 日
That is Matt's code, not mine; explanation should come from him.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by