[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3-dimensional array/matrix in oct-file: crashes
From: |
Mike Miller |
Subject: |
Re: 3-dimensional array/matrix in oct-file: crashes |
Date: |
Wed, 11 Dec 2013 18:11:18 -0500 |
On Wed, Dec 11, 2013 at 5:35 PM, marcimatz <address@hidden> wrote:
> [...]
> dim_vector dv (3);
> dv(0) = resolution[0];
> dv(1) = resolution[1];
> dv(2) = 3;
> NDArray mat(dv);
> [...]
> While the code for the RGB image crashes Octave, the code for the greyscale
> image works perfectly and displays a correct image. The initial 'image'
> buffer is not the culprit, even when I take it out of the loop, it crashes.
This dim_vector construction is also wrong. It works for a Matrix as
you saw and as shown in the manual, but for higher dimensional arrays
you should construct it like
dim_vector dv (resolution[0], resolution[1], 3);
The single-argument form results in a two-dimensional dim_vector
because vectors still have 2 dimensions in Octave.
--
mike