LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use an Image Control in Labview

I would like to use a System.Windows.Controls.Image to render dynamically generated images to the screen. Using the Image control requires writing the dynamic data to a source image, I have successfully written data into a Writeable Bitmap image source. I have been unable to render the image to the screen using an instance of the Image control. As a sanity check I have used the data from the writeable bitmap buffer and displayed it using a Picturebox control in a .net container to show the source image was successfully constructed. I'm sure the issue lies in a misunderstanding of mine when it comes to the Image control, so I was wondering if anyone could offer some insight.

 

VI with sanity check attached.

0 Kudos
Message 1 of 6
(5,892 Views)

A while ago I posted some of my Image Manipulation code that you might find useful.  The original purpose was to load an image into a control, and have the image fit to the control size, allowing for resizing of the UI and having the image automatically resize without needing extra code to poll and resize things.

 

https://forums.ni.com/t5/LabVIEW/Read-multi-image-tiff/m-p/3580103#M1002365

 

In addition to that it can also take the image, convert it to the LabVIEW Image Data type, manipulate it, and then put it back in.  This the the Grey Out Image feature.  This also supports Alpha layers to some extent which LabVIEW also doesn't handle well.  Included in the zip is an image that has a shadow that can be seen.  All this using .Net and the PictureBox.  Of course that being said working with the native 2D picture control is probably a better solution if you don't have a need for a feature missing in that implementation.

Message 2 of 6
(5,872 Views)

Thank you very much, I'll take a look

0 Kudos
Message 3 of 6
(5,869 Views)

Hooovahh, thank you for sharing your .net PictuerBox code it very extensible and cleanly shows how to use the picture box. I will likely be referencing it for time to come ;). In the current application I am trying to develop I need to utilize the "containerless" Image control rather than the picture box, I have been successfully able to create a dynamic image source using a WriteableBitmat but I have not been able to render the image to the screen using the "containerless" Image control.

 

I have however, copyed the data from the WriteableBitmat buffer to a system.drawing.bitmap that I was then able to render in a picture box. This tells me I have constructed a valid image source for the System.Windows.Controls.Image but I have not been able to display in on  the screen.

0 Kudos
Message 4 of 6
(5,850 Views)

Many of those words went over my head, and the extent of my .Net and image manipulation knowledge is in those VIs.  If you are looking for more than what is seen in them then I likely can't help you any more, sorry.  If you do get anything working please be sure and share it here.

0 Kudos
Message 5 of 6
(5,847 Views)

I greatly appreciate you taking the time to help me! I learned a lot more about the PictureBox and for that I am thankful. This illusive Image control has been a nagging thorn in my side.

0 Kudos
Message 6 of 6
(5,842 Views)