How to pad zeros?
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
Image Analyst
2012년 9월 5일
편집: Image Analyst
2012년 9월 5일
You can use the padarray() function. It's meant for doing exactly this.
paddedArray = padarray(originalArray, [1 1]);
댓글 수: 3
Sabarinathan Vadivelu
2012년 9월 5일
Dishant Arora
2012년 9월 5일
paddedArray = padarray(originalArray, [1 1],'post');
Image Analyst
2012년 9월 5일
Sorry - I misread and thought you wanted an extra zero all the way around. Thanks, Dishant, for the correction.
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!