LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed of variant to data

Hi,
 
I am trying to read an image from another program using ActiveX. The image is a 512x512 array of 16-bits integer values. I convert it to an usable array using the Variant to Data VI. However it takes this VI more than 100 ms to convert the variant to an array of integers, which I then convert to a suitable 8-bit Pixmap.
 
Is there any way to speed up this conversion of variant to integer array, or is there another method to do what i want?
 
Laurent
0 Kudos
Message 1 of 8
(3,136 Views)
Hi there,
 
if the ActiveX - Control returns the data only as a variant you don't have any other choice than using the VariantToData function.
 
On my machine (P4 2.2 GHz 1GB RAM LV7.1 XPSP2) it takes about 3 ms to convert a 512x512 U16 Array from Variant to G.
 
best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 8
(3,118 Views)
Are you converting a single element at a time or the whole array at once?? You should be able to do the entire array in one shot. Show us some code.
0 Kudos
Message 3 of 8
(3,107 Views)

hi there

i presume the AX returns scalar Variant. see attachment

 

best regards
chris

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 8
(3,102 Views)
Hmm, when I run your example then I also get approximately 3 ms for the Variant to Data-VI. I attached an image of the part of the VI that I am talking about here. Maybe the data types do not match, in which case I need to find a way to determine the datatype of the array that the ActiveX is producing.
0 Kudos
Message 5 of 8
(3,083 Views)
Well, I probably need another way to read this array of Variant type. Is it possible to wire it directly into a VI that will convert it to a picture?
0 Kudos
Message 6 of 8
(3,047 Views)
hi there
 
i did some tests:
 
source   target  deltat (ms)
(variant)
 
dbl          u16     100
sgl          u16     100
u8/i8       u16     50
u32/i32   u16     50
 
when the datatype of target and source are identical the conversion takes <5 ms.
 
i would just try all datatypes (not that much work) and see whats best.
 
best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 7 of 8
(3,024 Views)

Hello,

I noticed that you wired an empty array to the variant to Data,
I guess performance should improve if you already wire the correct size
since all the images are the same size.

With kind regards,

Technico

0 Kudos
Message 8 of 8
(3,007 Views)