11-17-2008 03:17 PM
I am trying to open a file to view an image. I do not know the image type...(let's say that it is a JPEG, but I don't know if it was a grayscale float, U8 or what.) I would like to open it in it's native format rather than just opening it in the U8 or some other format that may be incorrect.
Is there a way to read the image format and then do the create image thing with the correct format....?
Thanks for your help.
11-17-2008 03:23 PM - edited 11-17-2008 03:31 PM
On windows you're stuck to read the extension of the file and hope that it is correct. If it is an Jpeg you can use LabVIEW functions to open this file. (no matter what the dept-size is).
If you like to go deep you could read the data file itself, dig the dimensions, file type, etc. parse the file and display the image, but I would go the easy way.
If you want really easy, take this OpenG function that reads the extension decides to read it as PNG, Jpeg or bmp and returns the image:
Ton
11-17-2008 03:29 PM
If you open the file using a "Create Image" definition with no image type definition, then the image gets read from file as an 8 bit grayscale. I don't see how to go to the file, get the information about how the image was originally made (bit depth, pixels x and y, and stuff...) I see the IMAQ add and get file information functions, and I suppose once you have read the image you can append this set of information and not have any more trouble. You have the same advantage when dealing with FITS files. I thought JPEG had a header you could read that would let you see all that stuff....Just curious...it would be very helpful.
11-17-2008 03:32 PM
Sorry I have limited experience with IMAQ.
Ton
11-17-2008 03:48 PM
The Read JPEG, Read PNG, and Read BMP File VIs in the Graphics & Sound palette (Graphics Formats subpalette) may do what you want. You do need to know the format in advance to know which VI to use. These are not part of the Vision or IMAQ functions.
Lynn