Forum

Author Topic: Support multiple RGB jpgs (eg 2 as 6-band) or jpg-tif mix for multispectral cams  (Read 730 times)

andyroo

  • Sr. Member
  • ****
  • Posts: 455
    • View Profile
We are producing derivative jpgs (same size) from original jpgs and would like to be able to align them as 6-band or 9-band multispectral images using only a single master band (or only RGB from a single image) to accurately propogate ALL pixel values from all images into a multispectral dense cloud.

Right now we have to separately align all three jpgs as master/slave cameras or duplicate the data to create n-band multilayer tiffs.

Slave cameras do not align well because we are dramatically simplifying derivative images (into only a few colors), and n-band multilayer tiffs mean duplicating multi-terabyte datasets.

As far as I can tell there isn't a way to do this in the API or the GUI, and even if I try to lock down the slave cameras to have the same position and lens model as the master cameras, they increase error because there is insufficient information in their bands and erroneous tiepoints are generated.

andyroo

  • Sr. Member
  • ****
  • Posts: 455
    • View Profile
Actually I misspoke a bit - I actually have a JPG and a PNG and want to process them as 6-band imagery instead of master/slave sensors.

I can't do that yet within metashape, so I had to hunt for how to build a 6-band tiff. Here's my workflow with gdal and exiftool in case anyone finds it useful.

This method should work to make any number of images into a n-band image which contains the sum of the number of bands in the source images. unfortunately this method requires decompression and re-encoding of source images, which I was hoping to avoid.

#make 6-band tif from 3-band jpg and 3-band png:
for %i in (dir jpg_raw\*.jpg) do gdal_merge -o .\6band\%~ni.tif %i .\prob_stack\%~ni_seg.png -separate

#copy exifdata from source to dest images:
exiftool -tagsfromfile .\jpg_raw\%f.jpg -all:all -ext tif .\6band