LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET picturebox convert to LabView image

Solved!
Go to solution

I do have an IDS camera with the LV-driver. Unfortunately the driver uses .NET and therefore I have the camera image in a picturebox. Now I would like to do some image processing and therefore I

need to have the LabView image at this point and not the picturebox.

 

Question:

How can I "convert" the current picturebox into a LabView image? Saving and loading the image is no option because it would be to slow.

 

 

Thanks

Message 1 of 27
(17,426 Views)

Is it the Picture to Pixmap you need?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 27
(17,403 Views)

I do have the .NET picturebox. This picturebox I need to "convert" into a Imaq-image for further image processing.

0 Kudos
Message 3 of 27
(17,398 Views)

.NET is quite problematic, i hope someone has an answer as i'm eager to learn. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 27
(17,393 Views)

Norick_17 wrote:

Question:

How can I "convert" the current picturebox into a LabView image? Saving and loading the image is no option because it would be to slow.

 


there exists a methode node whith which you can copy the recent PictureBox content to clipboard in order to acces the image's bytes:

2015-04-27_picturebox_clipboard.PNG

 

Regards,
Alex

0 Kudos
Message 5 of 27
(17,384 Views)

I posted these VIs before but I can't seem to find where.  Attached is some image utility VIs that do some interesting things with .Net.  Extract the zip and open the Demo Load Image.  This will load a PNG file with alpha layer transparencies and display it in a picture box.  You can then grey out the image and it does this by converting the image to LabVIEW data, applying an opacity change to 50% and then convert it back to .Net and display it.  I also have added some code showing how to get the image from a picture box, and then going from there.

 

The working part of this is taking the image, (from a picture box) and saving it to a stream as a PNG.  Then you use a vi in the vi.lib which takes a PNG stream and turn it into LabVIEW data image.  Being able to go from .Net image data, to LabVIEW and back is very powerful because you can do what is easiest in whatever platform you want and jump back and forth as needed.  This demo was originally made to demonstrate how .Net is good at transparencies and alpha layers, and LabVIEW is not, but you can combine the two to get what you want.

Message 6 of 27
(17,373 Views)

Hello Alex

looks good but the output is a picture unfortunately. What I'm looking for is an imaq-image.

How can I get the RGB imaq-image?

 

thanks!

0 Kudos
Message 7 of 27
(17,346 Views)

Hello Hoooovah

the attached vi's are good but I think there is the same issue here. How can I get the imaq-image out of the 2D-picture?

 

Thanks

0 Kudos
Message 8 of 27
(17,340 Views)
Solution
Accepted by Norick_17

@Norick_17 wrote:

How can I get the RGB imaq-image?

 


@Hooovahh, aka Labview-Overlord, showed us how to get the image data in bytes frome the .NET Picturebox, which is 1d Array of U8 values

 

Reshape this 1d Array to a 2d Array according to height and width of your input array and then feed this 2d array in the imaq_arraytocolorimage.vi

 

 

 

 

0 Kudos
Message 9 of 27
(17,307 Views)

I added following code...

 

 

to imaq-image

 

 

 

 

 

and it works now!!!

 

Thanks a lot!

0 Kudos
Message 10 of 27
(17,287 Views)