Deadwood-ai / deadwood-api

Main FastAPI application for the deadwood backend
GNU General Public License v3.0
0 stars 0 forks source link

adding spectral_peroperties in upload_geotiff #14

Closed JesJehle closed 3 months ago

mmaelicke commented 3 months ago

@JesJehle do you know how I can automatically obtain this info? The Tiff header for 3 randomly checked Tiffs had no info in color space in their header. Here is on of the outputs:

{'Path': '/data/archive/0696ff3b-031e-4822-8374-78097c429798_uavforsat_2017_CFB060_ortho.tif',
 'Driver': 'GTiff',
 'COG': True,
 'Compression': 'DEFLATE',
 'ColorSpace': None,
 'COG_errors': None,
 'COG_warnings': ['The file is greater than 512xH or 512xW, it is recommended to include internal overviews'],
 'Profile': Profile(Bands=3, Width=28671, Height=17015, Tiled=True, Dtype='uint8', Interleave='PIXEL', AlphaBand=False, InternalMask=False, Nodata=255.0, ColorInterp=('red', 'green', 'blue'), ColorMap=False, Scales=(1.0, 1.0, 1.0), Offsets=(0.0, 0.0, 0.0)),
 'GEO': Geo(CRS='EPSG:4326', BoundingBox=(8.302994381147128, 47.69986736784068, 8.305718164350571, 47.70148381551277), Origin=(8.302994381147128, 47.70148381551277), Resolution=(9.500133247684173e-08, -9.500133247684173e-08), MinZoom=17, MaxZoom=24),
 'Tags': {'Image Metadata': {'AREA_OR_POINT': 'Area'},
  'Image Structure': {'COMPRESSION': 'DEFLATE', 'INTERLEAVE': 'PIXEL'}},
 'Band_Metadata': {'Band 1': BandMetadata(Description=None, ColorInterp='red', Offset=0.0, Scale=1.0, Metadata={}),
  'Band 2': BandMetadata(Description=None, ColorInterp='green', Offset=0.0, Scale=1.0, Metadata={}),
  'Band 3': BandMetadata(Description=None, ColorInterp='blue', Offset=0.0, Scale=1.0, Metadata={})},
 'IFD': [IFD(Level=0, Width=28671, Height=17015, Blocksize=(256, 256), Decimation=0)]}

Or is is part of the profile metadata tag? How would ColorInterp look like if the spectral properties are not RGB?

mmaelicke commented 3 months ago

To clarify, this is the metadata header of the original file, not the COG.

JesJehle commented 3 months ago

Based on the deadtree_db_planning.docs we should distinguish between RGB and NIRRGB we could check for bands. RGB if has 3 bands and red, green, blue in it. if it has more then 3 bands, NIRRGB. What could go wrong? :)

JesJehle commented 3 months ago

of course we would need to assume, that this is true. Since we are only interested in RGB for now. All other bands are optional. So we basically only need to be sure, that RGB bands are present. if NIRRGB is false for some wired reason, it's not too important.

JesJehle commented 3 months ago

25

cmosig commented 3 months ago

The spectral information needs to be user-supplied. There is no standard for how the band interpretation is encoded in the GeoTiff.

Also 4 bands dont necessarily mean RGB+NIR. The 4th band can also be an alpha channel generated during orthophoto generation (alpha channels shall be ignored).

mmaelicke commented 3 months ago

So I close this issue here, as the API already takes this as a user-input