ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get .NET array from Object

Solved!
Go to solution

Hi,

I have .net library that returns data as System.Object that is really a byte array ("The pixel data buffer is provided as a byte array for a grab result"). I want to get them as LabVIEW array. 

 

pylon grab result pixel data.png

 

 

Width and Height return image size, they work fine, so I have image data.

In C# it is done as following:

// Access the image data.
Console.WriteLine("SizeX: {0}", grabResult.Width);
Console.WriteLine("SizeY: {0}", grabResult.Height);
byte[] buffer = grabResult.PixelData as byte[];
Console.WriteLine("Gray value of first pixel: {0}", buffer[0]);

It is Basler USB camera through their Pylon. I do not have NI vision.

Thanks for help!

0 Kudos
Message 1 of 3
(3,737 Views)
Solution
Accepted by topic author Alexander_Sobolev

Problem solved.

Simply .Net object to variant.vi from .net palette.

Message 2 of 3
(3,705 Views)

I have the same question.

Thanks for your help

0 Kudos
Message 3 of 3
(3,594 Views)