Afficher commentaires plus anciens
I have an image whose size is 1023*1023. I want to make this image as 1024*1024 by zero padding.
A = zeros (1023,1);
I1 = horzcat (I1,A);
I2 = horzcat (I2,A);
B = zeros (1,1024);
I1 = vertcat (I1,B);
I2 = vertcat (I2,B);
Is this right?
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 5 Sep 2012
Modifié(e) : Image Analyst
le 5 Sep 2012
You can use the padarray() function. It's meant for doing exactly this.
paddedArray = padarray(originalArray, [1 1]);
3 commentaires
Sabarinathan Vadivelu
le 5 Sep 2012
Dishant Arora
le 5 Sep 2012
paddedArray = padarray(originalArray, [1 1],'post');
Image Analyst
le 5 Sep 2012
Sorry - I misread and thought you wanted an extra zero all the way around. Thanks, Dishant, for the correction.
Catégories
En savoir plus sur Particle & Nuclear Physics dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!