08-08-2006 12:41 AM
for (j=0; j<rows; j++)
{
for (i=0; i<column; i++){
input[i+column*j] = image[i+column*j];
}
}
Where image is the array returned by the imagetoarray function
Thanks for your help
Harry
08-08-2006 01:00 AM
08-08-2006 09:49 PM
Thanks for your reply,
I'm using just Visual C++ 2005 with NIVision libraries, I'm not using CVI. Does the function ConvertArrayType() come with Labview or IMAQ. Is there any function in NIVision or C++ to convert the type.
thanks
08-09-2006 07:45 AM
There's no sensible way of doing this without a loop somewhere or other. Even the library functions have loops in them.
As you're using VC++, you could implement the conversion in assembly language, which would be fastest. Failing that, you could at least get rid of the nested loop:
int nelements=rows*columns;
for (i=0;i<nelements;i++) input[i] = (double)image[i];
Note that VC++, in common with many compilers, will compile much more efficient code to do this conversion in 'release' configurations (with heavy optimisation) rather than in 'debug' configurations. So you might want to consider putting code like this in a separate module or library that is compiled in release mode, and then incorporating that library - rather than the source - into your project. This will enable you to get the performance you want even when debugging the remainder of the code.