[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3-dimensional array/matrix in oct-file: crashes
From: |
marcimatz |
Subject: |
Re: 3-dimensional array/matrix in oct-file: crashes |
Date: |
Wed, 11 Dec 2013 14:35:58 -0800 (PST) |
Thank you Mike.
I also tried that. No luck either.
Following is my code:
if (RgbImage)
{ // RGB. Crashes in the loop
dim_vector dv (3);
dv(0) = resolution[0];
dv(1) = resolution[1];
dv(2) = 3;
NDArray mat(dv);
for (int i=resolution[0]-1; i>=0; i--)
{
for (int j=0; j<resolution[1]; j++)
{
for (int k=0;k<3;k++)
mat(i,j,k) = image[pos++]; // image is a valid
array. Even with
mat(i,j,k)=0; is crashes!
}
}
}
else
{ // Greyscale. Doesn't crash and diesplays a correct greyscale image with:
imshow(mat);
dim_vector dv (2);
dv(0) = resolution[0];
dv(1) = resolution[1];
Matrix mat(dv);
for (int i=resolution[0]-1; i>=0; i--)
{
for (int j=0; j<resolution[1]; j++)
mat(i,j) = image[pos++];
}
}
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.
What can it be?
--
View this message in context:
http://octave.1599824.n4.nabble.com/3-dimensional-array-matrix-in-oct-file-crashes-tp4660015p4660023.html
Sent from the Octave - General mailing list archive at Nabble.com.