micasense / imageprocessing

MicaSense RedEdge and Altum image processing tutorials
https://www.micasense.com
MIT License
249 stars 148 forks source link

Image Processing Tutorial #1 does not deal with metadata in Pictures #4

Closed maykef closed 6 years ago

maykef commented 6 years ago

Hi,

The last line in your code does not save images as TIFFS, nor preserves metadata. The consequence is that uploading these images to Pix4D or Agisoft is useless, since all the metadata is lost and, therefore, no mosaic of the band can be created by the programs.

Please advise on using a specific library that preserves Metadata, or a method to copy and paste metadata in last images.

poynting commented 6 years ago

Hi @maykef, if your intent is to process with Agisoft or Pix4D you have a couple of options:

  1. Use the original files. Both of those software packages support RedEdge and implement the radiometric corrections internally. You don't need to pre-process the files.
  2. Use this tutorial as a reference and add your own code to save the files out to tiff using other libraries, then write the required metadata into the output files using exiftool. This can be challenging as most python image libraries don't properly support multi-page tiffs. You'll have to then determine which metadata is required for processing by your chosen software.

I'm closing this because the requested functionality is out of the scope of the tutorial.

We'll also be updating the tutorials soon and will provide extended functionality, including an example on saving data out to tiff files using gdal. We don't currently have writing of metadata out implemented, but we'd love to consider a pull request if someone wants to add that. I would just suggest waiting until the next update to do any work toward that end.

maykef commented 6 years ago

Understood Justin,

Thanks for this.

dud3r commented 6 years ago

Use the original files. Both of those software packages support RedEdge and implement the radiometric corrections internally. You don't need to pre-process the files.

I guess for Photoscan this is only true if you perform the whole "Calibrate Reflectance" process. What I mean is that you either get Reflectance values if you use Incident Light Sensor/Reflectance panels or Digital Numbers if you don't. From my experience there's no way to get only Radiance mosaics in Agisoft Photoscan. Would anybody know if the images are corrected for vignetting and row gradient, if the images are just processed normally (without "Calibrate Reflectance"). Maybe this question would be better addressed in the Agisoft forums? :-)

dud3r commented 6 years ago

Ok, one last comment on keeping metadata in the images. I haven't had any luck with Python libraries (pyexiftool, py3exiv2). But running exiftool from the command line has given me success. Photoscan does recognize my radiance calibrated images as MicaSense multispectral bands. The important thing is to copy the XMP tags blockwise (-xmp). If you just use exiftool the normal way and try to copy all tags from one file to another (-all) they will get "translated" or rearranged internally somehow. So the final command for transfering all metadata from MicaSense raw images to altered images would be:

exiftool -tagsfromfile IMG_0000_1.tif -xmp IMG_0000_1_RAD.tif exiftool -tagsfromfile IMG_0000_2.tif -xmp IMG_0000_2_RAD.tif

... and so on. Cheers.

Sources: Exiftool FAQ MicaSense Thread