Convert Float 32 bit to 16 bit using gdal commander

I use PhotoMosaic (a module of PhotoMod) software for stitching and color balancing rectified images. And it doesn’t support images from FLIR camera, since they are in 32 bit (floating point) tiffs. Therefore I have to convert all 32 bit images to 16 bit format to be able to use them in Photomod.

I use “gdal_translate -ot Uint16 -scale -40 120 0 65535 inp.tif out.tif” to convert thermal images which had original temperature range of -40 to 120 C to 16bit digital number ranging from 0 to 65535.  In Gdal Batch Commander I will just enter the underlined part of the above command and select all images and execute the same command on all the selected images.

Gdal Batch Commander float to 16 bit

Once mosacing process is complete, I convert 16bit mosaic back to 32bit float pixel values by using “gdal_translate -ot Uint16 -scale 0 65535 -40 120 inp.tif out.tif” command.

Best thing about gdal is that even after converting the pixel values from float 32 to 16 bit, still maintains geographical location information. And I can just use simple command line switches and convert hundreds of rectified tiff in single Gdal Batch Commander run.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s