Overview
In reading vision files, it is often useful to obtain the Image type, width, and height of the image before reading the image into memory. This allows us to create image space in memory for the appropriate type of image without hardcoding RGB32, U8 etc.
Description
This example demonstrates how we can utilize the Vision.FileInformation class to read what type of image is on disk. We can then allocate space in memory for the image with the appropriate type using the VisionImage class.
Steps to Implement or Execute Code
Note your ability to select different image types such as color and grayscale.
Requirements
Software
Visual Studio 2012
NI Vision .NET API
NI Vision Acquisition .NET API
Hardware
N/A
Additional Images or Video
Code snippet of the Get Image routine. This code snippet makes use of OpenFile Dialog for browsing image as well as the GetFileInformation function to retrieve information about the file on disk.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.