biren
1
An unhandled exception of type ‘System.OutOfMemoryException’ occurred in AForge.exe.
COMPLEX[] Fourier;
public void ForwardFFT()
{
//Initializing Fourier Transform Array
int i,j;
Fourier = new COMPLEX[320 * 240];
Output = new COMPLEX[Width*Height];
//Copy Image Data to the Complex Array
for (i=0;i<=Width -1;i++)
for (j = 0; j <= Height - 1; j++)
{
// Fourier[i][j].real =(double) GreyImage[i][j];
// Fourier[i][j].imag = 0;
}
//Calling Forward Fourier Transform
// Output= FFT2D( Fourier, nx, ny, 1);
return;
}
when Fourier = new COMPLEX[320 * 240]; called this exception shows. how to solve
Justin
2
@ biren - Whats a complex?
I would imagine that it is creating an array of objects that is consuming more ram and is available for your device.
Brett
3
I bet reducing your memory consumption will help.
Or buy a mainboard with more memory to start with; but the real issue is you have to THINK SMALL.
biren
4
@ Justin - complex is a structure.
struct COMPLEX
{
public double real, imag;
public COMPLEX(double x, double y)
{
real = x;
imag = y;
}
public float Magnitude()
{
return ((float)ElzeKool.exMath.Sqrt(real * real + imag * imag));
}
public float Phase()
{
return ((float)ElzeKool.exMath .Atan(imag / real));
}
}
Justin
5
@ biren - that one line is creating 153600 doubles which will be using alot of your poor wee processors resources…
biren
6
@ Brett - how to reducing memory?
biren
7
@ Justin - means? please explain with some details
Justin
8
@ biren - a double needs 8 bytes of memory.
Complex is 2 doubles so 16 bytes of memory…
Fourier = new COMPLEX[320 * 240]; is creating an array of 76800 complex items which needs 1228800 bytes of ram - 1.17mb of ram…
Hence why you are running out of memory
biren
9
@ Justin - means complex is not possible in microframework?
Justin
10
@ biren - Complex can still be used but not with such a large array on your board.