08-15-2010 07:50 PM
Hi all,
I have 12 bit gray scale images coming from a camera and am trying to save these images.
I called function "IMAQ Write to File 2" to do this job.
The function always scales the original data from 12 bit to 16 bit and then save it.
In the end, I have a 16-bit tiff image.
Is there anyway that I can save my original 12 bit data without any scaling?
Thanks a lot for your information.
08-29-2010 03:05 PM
hi,
for every data you save, a specific data type is used...so for example 16 bit integers, 8bit integers... there's no datatype with a length of 12 bit, so this can't be done by "simple methods"...if your intention is to save hard disk space, then better use a compression or use tif-files with lzw-compression. if you really like to save 12 bit, you can do it like this: use for example 16 bit integers for saving, but only use 12 bit...the left four bits are used by the next integer and so on:
2 16 bit integers:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - ...
use them as follow:
FIRST 12 BIT SECOND 12 BIT AGAIN 12 BIT
1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3
This will be a lot of calculation stuff, you can for example do it by converting a number to a bool array or mathematical functions...as you like
Hope this helps
christian