help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fftn code fails


From: Mike Miller
Subject: Re: fftn code fails
Date: Wed, 25 Sep 2013 10:52:16 -0400

On Wed, Sep 25, 2013 at 14:30:37 +1000, Terry Duell wrote:
> Hello All,
> I am investigating some code which is said to run in Matlab, but throws an
> error in Octave 3.6.4 (Fedora 19 x86_64).
>
> we have an image, "g", [254,254,3], and an array, "H", [9,9], as follows;
>
> [row col frame] = size(g)
> row =  254
> cols =  254
> frames =  3
>
> size(H)
> ans =
>
>    9   9
>
> When I call fftn, as per the Matlab code, I get an error, thus;
>
> fftn(H, [row col frame])
> error: fftn: SIZE must be a vector of length dim
>
> Is our fftn incompatible with the Matlab fftn?

Could be. I can't tell for certain from their documentation, but it
might extend or truncate the argument to the specified size, which is
what your code seems to be doing.

> If one can't use fftn in the manner shown above, how does one handle arrays
> such as the image in this example?
> Do we have to process each 2D layer (ie [254,254]) separately with fft2 and
> then combine later into a  [254,254,3] result?

No, you should be able to fftn your image g with no trouble. The error
you get is only because H has fewer dimensions. Try padding H to have
the same size as g, something like

  H2 = zeros (size (g));
  H2(1:9,1:9,1) = H;
  fftn (H2)

as a workaround.

Please report a bug if you think this is an incompatibility.

-- 
mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]