padarray for resizing canvas of images
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 18 Oct 2014
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 Comments
Image Analyst
on 18 Oct 2014
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.
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!