MATLAB: How change Image/2d array proportions

2d arrayimageImage Processing Toolboximagesc

Let`s say that I have a image (100×500) (a simple 2D-array)
But I know that this image has a real-world size as 25.4 cm heigh and 210 cm wide, i.e. the proportion are different.
How can I plot this image with the (real-world) proportion and also showing the labels from (0…25.4 cm) x (0…210 cm) ?
Thanks in advance.

Best Answer

  • Use imresize():
    [rows, columns, numberOfColorChannels] = size(yourImage)
    newWidth = round(columns * (210/25.4))
    yourImage = imresize(yourImage, [rows, newWidth]);