LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with dynamical creation of 2D-Array for ArrayToImage-Function in CVI - Problem mit dynamischer Erzeugung eines 2D-Arrays für ArraytoImage-Funktion

Hi there,

i've got the following problem:

I have an 1D-Array with all Pixelvalues for an U8-Greyscale-Image. Now i want to use the imaqArrayToImage-function from the vision-Addon.

Now i want to create the 2D-Array at run time. I use the following Code:


                    data = (unsigned char**) malloc (sizeof(unsigned char*)*nboflines);
       
                    for (i=0; i<(nboflines) ;i++)
                    {
                        data[i] = (unsigned char *) malloc (sizeof(unsigned char)*nboftabs_line);
                    }

Then i sort all the values from the 1D-Array to the 2D-Array. When i now use the imaqArrayToImage-function in this way:

maqArrayToImage (picture, data, nboftabs_line, nboflines);

I get the following error: "Array argument too small (xyz Bytes). Argument must contain at least abcdef Bytes (abdcf elements)"

When i take a look at the created 2D-Array. I'll see that all the values was read right, but the size isn't right. I'll become an Array with more lines than i need....

Please help..

mfg

Dodo
"For every complex and difficult problem there's a simple, straightforward solution that's absolutely wrong. " - www.uni-soest.de
0 Kudos
Message 1 of 2
(2,865 Views)
hello dodo,

do you have a little example, with demo values, where the behaviour could be reproduced?

regards,

robert h
NI germany
0 Kudos
Message 2 of 2
(2,829 Views)