I have a code for drone image calibration and aligning from Micasense which works with 16bit images (Tiff). Alternatively the author of the code uses rawpy to read 12bit Tiff images(link: https://github.com/micasense/imageprocessing/issues/78). My images are all DNG 12bit but I cannot get rawpy to read it.

Screen shot of the code and error

However if i give it 16bit Tiff images it gives no error and the code runs.

I have tried reading about it but so far have not been able to find why rawpy cannot read my images. Am I missing something?

Alternatively, I thought of getting around the problem by converting my images into 16bit with gdal. Screen shot of code using gdal Which works fine, except that the metadata of the resulting 16bit Geotiff is less than original (using Exif to check this) and the image looks really dark. For my purposes I need the full metadata for calibrating the images later and also further processing on maps. So I need the whole metadata and a better scaling algorithm.

One idea is to copy the metadata of the original 12bit, then convert the image to 16bit (using scaling equation which gave good results) then find a way to greate a new GeoTiff using the ndarray and the metadata. I have not found an easy way to do this. Reading online Exif should be able to extract and save the metadata but then I need to find a way to combine 16bit scaled ndarray with metadata into geotiff. which I have not found yet. Is there a way to do this?

I would prefer using rawpy since its easier and also because I am trying to make a pipline with the code later. But if no solution then I would appreciate any hints on how to get the second idea working or any clever ways to get around the 12bit problem while keeping the metadata intact. Thank you.

here is an example of the 12bit image: https://tubcloud.tu-berlin.de/s/ba44SsEdNACgbM7

0

There are 0 answers