Filter löschen
Filter löschen

Matrix Zero padding for filter (image processing)

1 Ansicht (letzte 30 Tage)
YongHyun
YongHyun am 14 Mai 2016
Beantwortet: Azzi Abdelmalek am 14 Mai 2016
I have a matrix and size 5x5. I want to zero padding between each row and column. Thus, result matrix is 9x9 after zero padding. I'll use this in wavelet zero-padding. Thanks!!
matrix = ones(5)
result_matrix = [1 0 1 0 1 0 1 0 1;
0 0 0 0 0 0 0 0 0;
1 0 1 0 1 0 1 0 1;
0 0 0 0 0 0 0 0 0;
1 0 1 0 1 0 1 0 1;
0 0 0 0 0 0 0 0 0;
1 0 1 0 1 0 1 0 1;
0 0 0 0 0 0 0 0 0;
1 0 1 0 1 0 1 0 1]

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 14 Mai 2016
a = ones(5);
out = zeros(size(a)*2-1);
out(1:2:end,1:2:end) = a;

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 14 Mai 2016
matrix = ones(5)
n=size(matrix,1)
result_matrix=zeros(2*n-1)
result_matrix(1:2:end,1:2:end)=matrix

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by