zero pad to resize an image

50 次查看(过去 30 天)
How to add zeros by comparing the file sizes of the two images?
Suppose the first image is 240x152 and the second image is 240x168
And i need to resize the first image using zeros to the same as the bigger one that is 240x168
so how is it possible to do the same?

回答(2 个)

Himanshu tripathi
Himanshu tripathi 2019-6-28
Try this
I = rand(240,152) ; // first image
iwant = zeros(240,168) ;
iwant(1:240,1:152) = I ;
  3 个评论
Himanshu tripathi
Himanshu tripathi 2019-6-28
Are you looking for this?
zero_matrix = zeros(240,168-152);
I = [zero_matrix,I]
Pravita Lekshmanan
Pravita Lekshmanan 2019-6-28
Yes exactly i was looking for the above answer and it worked well
Thankyou so much

请先登录,再进行评论。


AISWARYA SUBRAMANIAN
编辑:AISWARYA SUBRAMANIAN 2019-6-28
I would suggest you to look through the following link:

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by