[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem with imresize keeping aspect ratio
From: |
Carnë Draug |
Subject: |
Re: problem with imresize keeping aspect ratio |
Date: |
Tue, 4 Feb 2014 18:14:25 +0000 |
On 4 February 2014 02:06, inor0627 <address@hidden> wrote:
> Hello,
>
> I'm trying to resize an image using imresize and want to keep the aspect
> ratio.
>
> The function reference for using imresize(im, [M N]) says:
> "If M or N is NaN, it will be determined automatically so as to preserve
> aspect ratio."
>
> So when doing
>
> A = ones(8,6);
> B = imresize(A,[4 NaN]);
>
> I'm expecting B to be 4x3. But in fact B is 4x1.
> Can you please tell me where's my missunderstanding?
>
> Currently I'm using the workaround
> col=4;
> C = imresize(A , [col round(col*size(A,2)/size(A,1)) ] );
> which acts as expected. But I want to do it the right way :-)
>
> I'm using Octave-3.6.4-mingw with Octave3.6.4_gcc4.6.2_pkgs.
>
> Thank you,
> Ingo
You are using an old version of the image package that did not support
the use of NaN to mean, "keep aspect ratio". Does that option appears
documented when you use "help imresize", or did you found it on the
online html documentation for the new version?
Anyway, it works with the image package 2.2.0 and any version before
it should not include it.
Carnë