Any one give me the solution of this question or guide me how to solve this problem.

1 回表示 (過去 30 日間)
Abdul Rehman
Abdul Rehman 2022 年 11 月 25 日
コメント済み: Abdul Rehman 2022 年 11 月 27 日
Write a code to manually introduce zero padding in a 3*3 matrix. A 3*3 matrix, you have to generate the resultant matrix. You can assign any values to the input matrix. The black outline in the resultant represents the zero padded pixels while the remaining 9 (non zero) pixels must have the same values as assigned in the input 3*3 matrix.

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2022 年 11 月 25 日
編集済み: KALYAN ACHARJYA 2022 年 11 月 25 日
Is this: Manually as asked for
data=randi(255,[3,3]);
pad_data=zeros(5,5);
pad_data(2:end-1,2:end-1)=data
pad_data = 5×5
0 0 0 0 0 0 66 62 3 0 0 7 27 50 0 0 206 239 186 0 0 0 0 0 0
Using function padarray

Community Treasure Hunt

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

Start Hunting!

Translated by