padarray for resizing canvas of images
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have multiply PNG images in one folder with different images sizes (height and width), how can I use the padarray function so they will have the same canvas size (according to the bigger image) without resizing them?
Thanks a lot
0 个评论
回答(1 个)
Image Analyst
2014-10-18
Not hard. Just get the sizes of both, get the max, and figure out what to pass to padarray()
[rows1, columns1, numberOfColorChannels1] = size(image1);
[rows2, columns2, numberOfColorChannels2] = size(image2);
maxRows = max(rows1, rows2);
maxColumns = max(columns1, columns2);
and so on...
2 个评论
Image Analyst
2014-10-18
Because that's not the way to use padarray. Read the instructions. The inputs are the number of rows you want to add, not the overall total rows.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!