I have some multiple dimensional images. For example 150x250, 157x253, ...... ect. Now I want to resize each images having the row and column ratio fixed.
If I use imresize function, it resizes properly but the shape of the object inside the image is changed/distorted. Because it stretches or squeezes the image. I do not want to change the shape of the object on the image. That is why I want to resize the image with keeping the ratio of the image same.
The steps I need: 1. Matlab will resize the image (for example 150x250) into 30x50 (because of the fixed ratio). Here the largest value between the row and column value will be resized and the other one will be resized having the ratio same. In my example, resized row = 30 resized column = 50
2. Now, I want to add 10 black rows on the both side of the resized image. Which means: (10+30+10) = 50 rows (which is my required row size) and the columns will not be changed. This is how I can make the object placed in the center of the image.