ODM icon indicating copy to clipboard operation
ODM copied to clipboard

Does ODM support Tif format

Open xialang2012 opened this issue 11 years ago • 42 comments

I often use the multi-spectral camera to capture images in the experiment filed. So, I wonder if I can use Tif format files with multi-band, e.g. 10 bands in one Tif image, as input source images after some modifications. Is it a heavy work if I do this modifications? Thank you.

xialang2012 avatar Oct 29 '15 04:10 xialang2012

Pull requests welcome. TBH, I don't know what the implications are of multi-band (>3) tiffs... . @paulinus -- how wedded is the OpenSfM portion of the toolchain to the idea that the images are 3-band (let alone particular image formats)?

smathermather avatar Nov 01 '15 00:11 smathermather

@smathermather it means there are several channels images in one tiff file.

xialang2012 avatar Nov 02 '15 05:11 xialang2012

The SfM part of the pipeline only needs grayscale images. So you could convert the TIFs to RGB or grayscale jpg and run it. Which conversion to do from 10 channels to RGB or grayscale will depend on what those channels are, but it will not be very critical for SfM.

Stereo and meshing will also work fine just by using the converted images.

Texturing and orthophoto generation are more problematic, since they would need to deal with the 10 channels directly in order to produce a 10 channels output. I ignore how much work is required to modify these parts.

paulinus avatar Nov 02 '15 12:11 paulinus

Perfect. Thanks @paulinus.

smathermather avatar Nov 03 '15 01:11 smathermather

@paulinus It seems only the orthophoto is problematic. The work mainly focus on change the RGB to one channel, and revise the CV functions which used in the OdmOrthoPhoto.cpp.

xialang2012 avatar Dec 31 '15 08:12 xialang2012

I would highly appreciate tiff support. It would bring many advantages, mainly for multispectral sensors, even it is challenging. Precision is lost with conversion to JPEG, since tiffs can use other data types (up to 16 bit uints, floating numbers), since JPEGs use only 8bit data values.

ivopavlik avatar Jan 19 '17 14:01 ivopavlik

I think mvs-texturing can support tiff inputs so I think its just a matter of doing the conversion to greyscale for opensfm while keeping the original images registered to the point cloud (nvm)

edit: there's a branch for n-channel support but I don't think its implemented yet: https://github.com/nmoehrle/mvs-texturing/commits/n-channel-images

dakotabenjamin avatar Jan 19 '17 21:01 dakotabenjamin

Unfortunately, the mvs-texturing does not support the n-channel well. I have do some work on this branch, but due to the problem about the https://github.com/nmoehrle/mvs-texturing/issues/49 which is very difficult to solve. In fact, the https://github.com/nmoehrle/mvs-texturing/commits/n-channel-images does not run well on it's current form.

xialang2012 avatar Jan 20 '17 01:01 xialang2012

Hello, i was working with the camera Parrot Sequoia. It has 4 bands. The output of this camera is one tiff image for each band (4 images for each shot), 16 bits resolution. I wanted to do NDVI orthophoto (only 2 bands RED and NIR are needed). I did this steps:

  1. make jpg images with RED and NIR channels, with a simple python routine. In this step I had to reduce the resolution 16bits -> 8 bits :(
  2. run ODM with the jpg images.
  3. calculate NDVI with the ortophoto, with a python routine.

The results are OK as you can see, but i guess it is better to calculate NDVI with the 16bits channels.

is it possible to run the texturing step several times in order to ge one orthophoto for each channel?

imagen

LucasMM86 avatar Jan 20 '17 12:01 LucasMM86

Very cool. Can you share the scripts you used? We also have a Sequoia.

Texturing uses the generated .nvm file which registers specific images to the point cloud. You would have to run ODM completely with each channel separately.

I've never tried this but maybe you could spoof the image file names in the nvm file. I would recommend compiling mvs-texturing on its own and running it that way, probably easier than using ODM for that.

dakotabenjamin avatar Jan 20 '17 14:01 dakotabenjamin

Thanks for the update @xialang2012 I'm excited to see how that turns out.

dakotabenjamin avatar Jan 20 '17 14:01 dakotabenjamin

@LucasMM86 : Please be aware of the automatic gamma correction, which gets applied by the tiff>jpg conversion. IMO this will have a bigger impact on your data than 16 >> 8 bit conversion!

Fi156 avatar Jan 22 '17 22:01 Fi156

Thanks for the advice @Fi156 . This are the scripts i used. TiffJPG_python.zip

LucasMM86 avatar Jan 23 '17 11:01 LucasMM86

@LucasMM86 very much like your NDVI creation. Would the quality of the output be any better if you reverse the workflow? I.e. 1. calculate NDVI on each NIR and RED Tiff image pair via python and save as new tiff image 2. convert resulting ndvi image to jpg via python 3. upload NDVI image to ODM and stitch into ortho. I read in #182 that feature extraction might be more difficult, but just curious if anyone has had success and this would result in any better output? Clearly tiff support would be even better.

hblanken avatar Feb 04 '17 02:02 hblanken

Since the MVS-texturing does not work well for n-channel, the correct way to achieve it is as follow

1.convert to 8bits, and get meshing file 2.use the ODM texturing module to replace the MVS-texturing, and do a small revision of the ODM texturing module to make it correct to work with 16 bit, texture each channel 3.get orthophoto for each channel 4.calculate NDVI

The problem is the ODM texturing module lacks some functons, e.g. blending, hole filled, so the orthophoto obtains by using the ODM texturing module may not as good as MVS-texturing does.

I have completed this last year, but I can not find it now.

xialang2012 avatar Feb 06 '17 02:02 xialang2012

@hblanken : I tried to run ODM with NDVI images and the result where not very good. I have not the images here but i remember that the orthophoto had bad quality.

@xialang2012 : I am trying to go throw the 4 steps. I have trouble on step 2. I put the .tif 16 bit images in the images_resize folder and try to run with "--rerun-from mvs_texturing" option. I get the errror "Not enogh supported images in /home/lucas/Documents/Leones/images_resize" ¿should I change the code in order to avoid this error message? ¿or should I use another format for the images?

LucasMM86 avatar Feb 06 '17 11:02 LucasMM86

Running ODM on any index (ratio data) directly is unlikely to give a good result. The entire purpose of NDVI and other indexes is to remove the noise of features and focus on spectral differences, but for matching, features are what we want.

smathermather avatar Feb 06 '17 18:02 smathermather

Hello. I tried to convert my tiffs to 3 band byte jpegs. Then I processed each band separately and then I built virtual RGB raster from RGB separate bands. Unfortunately, bands are shifted each other quite significantly as you can see below. Any clues how to optimize process would be appreciated. opendronemap

ivopavlik avatar Feb 20 '17 16:02 ivopavlik

@ivopavlik why do you process each band separately? why do you not process the JPGs with the 3 bands together? The result you are showing has orthophotos of different bands?

LucasMM86 avatar Feb 20 '17 16:02 LucasMM86

Pictures were taken with Micasense RedEdge multispectral sensor. It has separate lenses for each band shifted few cms from each other. It takes picture (by the way tif) for each band separately, where is also some shift and it is not possible to merge it to single image.

ivopavlik avatar Feb 21 '17 11:02 ivopavlik