LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C# PictureBox to Labview Image

Using a Camera that came with a C# dll.  Been able to mimic operation in Labview using invoke nodes to the .dll file.

Having an issue with bringing the picturebox picture into a Labview Image.  I can see the image appear in the picturebox on the Labview screen. Have been unsuccessful in being able to create an image picture in Labview from the  picturebox. The labview code is below, structured as an experiment..  I suspect I am missing something to get the picturebox Image to copy to a Labview picture.  So far always get a grey screen of the new picture indicator.

Any obvious thoughts on this?  

 

cvier_1-1589487975156.png

 

 

0 Kudos
Message 1 of 6
(3,599 Views)

I think LabVIEW only sees the container when it takes an image, not whatever an external DLL puts into the container.

 

I think what you need to do is take that PictureBox.Image reference, and use additional .NET nodes to change that into a byte array and then reformat that array into a LabVIEW image format, or to whatever format you need (if the LabVIEW one was just an intermediate step, for instance).

 

I found this StackOverflow post on how to convert a .NET image to a byte array, but after that it depends on things like the size of the image and the bit depth of the image.

0 Kudos
Message 2 of 6
(3,554 Views)

Read thru Stack Overflow and have been trying and reading for the last 2 days,  it is a little over my head to understand this enough to solve .

0 Kudos
Message 3 of 6
(3,530 Views)

Hi cvier

       Did you find an answer to this problem?

0 Kudos
Message 4 of 6
(1,876 Views)

There are VIs around for converting a .NET image or image in a picturebox to a 2D array of pixel values. I believe this should include it, for instance: https://forums.ni.com/t5/LabVIEW/NET-picturebox-convert-to-LabView-image/m-p/3125944#M897890


___________________
Try to take over the world!
Message 5 of 6
(1,865 Views)

How good is your Google foo?

https://letmegooglethat.com/?q=LabVIEW+.Net+Picture+to+Image

 

First link is this thread: https://forums.ni.com/t5/LabVIEW/NET-picturebox-convert-to-LabView-image/td-p/3125712

 

About the 6th post in that thread from LabVIEW Overlord Hooovahh, aka Brian, gives you exactly the solution! the rest of that thread might be interesting too.

Rolf Kalbermatter
My Blog
Message 6 of 6
(1,863 Views)