Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Lossless imaq write format?

Hello all,
 
I've been reading various help files and getting various answers.  Here is the setup: I am reading in a 10 bit monochrome image from a camera.  It is stored and worked with as a 16 bit image in labview.
 
Now I want to write two images out, one as a quick and dirty jpeg for a quick qualitative idea of the data taken.  Another as a lossless (filesize not too big an issue) image for postprocessing and calculations.
 
The problem is that I'm trying to use IMAQ Write File 2, and it has many formats, of which it claims:
 
IMAQ Write JPEG2000 File 2

Lossless? (true) specifies the type of compression used to save the image. Set this parameter to TRUE to save the image with no loss of data. Set this parameter to FALSE to save the image with a loss of data.

IMAQ Write PNG File 2

Image Quality specifies the amount of compression applied to the image. Image Quality can range from 0 to 1000. The default value is 750. The higher the value, the less compression the VI applies.

Note  JPEG compression is lossy, which means that the lower the quality specified, the more loss takes place during the compression. Also, a small amount of loss can occur even when the quality is 1000.

Ironically however, from wikipedia (http://en.wikipedia.org/wiki/JPEG_2000), as well as the labview website itself (http://zone.ni.com/devzone/cda/tut/p/id/2884) it makes the claim that the png file is the one which is lossless.  (Also for some odd reason the help file regarding the write png file is talking about jpeg compression...)

Is the built-in helpfile wrong, and PNG files are indeed lossless?

Thanks,
Ming

Also, I seem to be getting an "invalid image type" error when I try to feed my images into the various write commands (simultaneously trying out bmp, jpeg, etc).  I've read that many of these only take 8-bit images, but I was under the impression that the png and jpeg format should work fine with 16 bit images?

0 Kudos
Message 1 of 4
(4,756 Views)
Sorry, one additional question.  I do not understand why, but I am having immense difficulty trying to open the jpeg2000 format files.  Do most computers require an additional plugin for this format?
 
Thanks again!
Ming
0 Kudos
Message 2 of 4
(4,754 Views)
Ming -

Firstly, the PNG format is always lossless.  I have filed a CAR about that and hopefully the documentation will be fixed in our next version.  Good catch!  You can still set the Image Quality for PNG, but it just affects time to write and file size - no matter what you choose it will be lossless.

Secondly, the JPEG2000 format can be either lossy or lossless (see the JPEG2000 Features section of the Wikipedia page).

You are correct that both PNG and JPEG2000 should support I16 images (BMP will not) - if you're still having this problem can you post your code so I can take a look?

Are the JPEG2000 files you're having trouble opening written by NI Vision or are they written by external programs?  If they're written by NI Vision we should be able to read them without a problem.  If they're written by an external program, the problem might be that they have multiple layers and we don't support reading those.

Greg Stoll
Vision R&D
National Instruments
Greg Stoll
LabVIEW R&D
Message 3 of 4
(4,731 Views)

I also cant seem to get the jpeg2000 routine to write 16bit greyscale images.  They come out at with 256 greys...

 

Any news on this? Perhaps another way / parameters to call the dll?

 

 

0 Kudos
Message 4 of 4
(3,868 Views)