Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I determine the type of image to use before loading an image?

Solved!
Go to solution

I am developing an app using VB 2005 that measures either 16-bit or 8-bit image files. When I read the image, I am finding that I must set the image type of the image buffer before reading the image into it. For example, if I read a 16-bit image into an 8-bit buffer the image is truncated. I suppose I could read the image into an 16-bit buffer and re-type it if pixel values are less than 255.

 

Is there a better way to do this? Can I determine the bit depth of an image before loading it into a buffer?

 

Thanks!

Message Edited by Steverino on 12-09-2009 04:13 PM
Message Edited by Steverino on 12-09-2009 04:13 PM
0 Kudos
Message 1 of 3
(3,635 Views)

Hi Steverino,

 

For you to be able to determine the bit depth of an image, it has to be loaded first

0 Kudos
Message 2 of 3
(3,606 Views)
Solution
Accepted by Steverino

Hi Steverino,

 

Olivia is incorrect.... VDM has a function called GetFileInfo that does just what you want. This only reads the header of the image but does not load the entire image into memory. It will give you various properties such as the bit depth.

 

I believe on the new .NET support it might exist here: NationalInstruments.Vision.Analysis.Algorithms.GetFileInformation.

 

Through CVI and our legacy .NET support it is likely a similar name.

 

Eric

Message 3 of 3
(3,598 Views)