Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create >8-bit grayscale video files?

I work with a number of cameras and a number of them produce 12-bit or 14-bit grayscale images. I'm able to save the images to a series of 16-bit TIFF or PNG images to preserve the dynamic range of the images but in order to create a video file (such as an AVI) I have to convert the images first to 8-bit grayscale.

Does anyone know how to create a grayscale video file that supports more bit depth?

Thanks,
Bruce
0 Kudos
Message 1 of 6
(5,749 Views)

Hey Bruce,

 

Unfortunately, the AVI file format only supports 8-bit grey scale or RGB image types. So, there would not be any straight forward way to save your 12 or 14 bit images to video in a gray scale. However, there are some work arounds that would allow you to maintain image depth.

 

One way would be to save your grayscale image to and RGB file type and roll over the extra bits to another color plane. Check out this Community Example that outlines this method. Alternatively, you could convert your images to arrays and save them directly to a binary file. This would allow you to have whatever bit depth that you would like.

Message Edited by BCho on 11-24-2009 09:12 AM
Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 2 of 6
(5,729 Views)

Thanks for responding.  With high definition video supporting bit depths higher than 8-bits per color I was hoping that there was something already available for this which I might be able to use.  AVI is a container so it's possible to cram a lot of different things into an AVI.

 

It may be possible to save to a QuickTime file using Chris' QuickTime VIs, but I haven't explored this option yet.  Are you familiar with this toolset?

 

 

Thanks,

Bruce

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

Hey Bruce,

 

Those QuickTime VI's you pointed out might work for you. However, they look like they are a set of custom VI's that someone has simply put together and shared so I can not be too certain. This would be the first time I have heard of them, so I don't have any personal experience with them. As it says near the top of that page 'Use theses VIs at your own risk (make a backup first)'

Hope this helps.
-Ben

WaterlooLabs
0 Kudos
Message 4 of 6
(5,719 Views)

Well I checked into the QuickTime VIs and these seem to have the same 8-bit limit. 

 

Not directly related to this topic but I was also thinking about that example you provided.  I think it may be better if the values are interleaved between the 3 colors instead so that the image still looks respectable when viewing with normal AVI viewers.  I still have to try it out but I think it could work.

 

R        G        B        Value

00000000 00000000 00000000 0

00000000 00000000 00000001 1

00000000 00000001 00000001 2

00000001 00000001 00000001 3

00000001 00000001 00000010 4

...

and so on.

 

Hopefully it can be optimized to provide good throughput encoding and decoding.

 

Bruce

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

My brain must not have been functioning properly.  That method overflows after 1533!

 

Oh well, back to the drawing board.

 

Bruce

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