[gdal-dev] Questions about processing four band (RGBI) imagery

Even Rouault even.rouault at mines-paris.org
Wed May 28 11:07:28 PDT 2014


Le mercredi 28 mai 2014 16:35:39, Jonathan Moules a écrit :
> Hi List,
>   I have four band (RGB plus Infrared) imagery from some aerial photography
> we've had flown. I've already used GDAL to create suitable optimised RGB
> GeoTIFFs using this data and now want to do it with the Infrared band too.
> 
> The RGBI data is about 1TB uncompressed, currently stored as 2732 GeoTIFF
> tiles compressed with LZW:
> 
> Files: SK1400.tif
> 
> >        SK1400.tfw
> > 
> > Size is 8000, 8000
> > Coordinate System is:
> > PROJCS["OSGB 1936 / British National Grid",
> > 
> >     GEOGCS["OSGB 1936",
> >     
> >         DATUM["OSGB_1936",
> >         
> >             SPHEROID["Airy 1830",6377563.396,299.3249753150316,
> >             
> >                 AUTHORITY["EPSG","7001"]],
> >             
> >             AUTHORITY["EPSG","6277"]],
> >         
> >         PRIMEM["Greenwich",0],
> >         UNIT["degree",0.0174532925199433],
> >         AUTHORITY["EPSG","4277"]],
> >     
> >     PROJECTION["Transverse_Mercator"],
> >     PARAMETER["latitude_of_origin",49],
> >     PARAMETER["central_meridian",-2],
> >     PARAMETER["scale_factor",0.9996012717],
> >     PARAMETER["false_easting",400000],
> >     PARAMETER["false_northing",-100000],
> >     UNIT["metre",1,
> >     
> >         AUTHORITY["EPSG","9001"]],
> >     
> >     AUTHORITY["EPSG","27700"]]
> > 
> > Origin = (414000.000000000000000,301000.000000000000000)
> > Pixel Size = (0.125000000000000,-0.125000000000000)
> > 
> > Metadata:
> >   AREA_OR_POINT=Area
> > 
> > Image Structure Metadata:
> >   COMPRESSION=LZW
> >   INTERLEAVE=PIXEL
> > 
> > Corner Coordinates:
> > Upper Left  (  414000.000,  301000.000) (  1d47'35.68"W, 52d36'22.49"N)
> > Lower Left  (  414000.000,  300000.000) (  1d47'35.83"W, 52d35'50.12"N)
> > Upper Right (  415000.000,  301000.000) (  1d46'42.51"W, 52d36'22.40"N)
> > Lower Right (  415000.000,  300000.000) (  1d46'42.68"W, 52d35'50.03"N)
> > Center      (  414500.000,  300500.000) (  1d47' 9.18"W, 52d36' 6.26"N)
> > Band 1 Block=8000x32 Type=Byte, ColorInterp=Red
> > Band 2 Block=8000x32 Type=Byte, ColorInterp=Green
> > Band 3 Block=8000x32 Type=Byte, ColorInterp=Blue
> > Band 4 Block=8000x32 Type=Byte, ColorInterp=Undefined
> 
> My goal is to create a mosaiced GeoTIFF image with all four bands in it. It
> should be as small as possible without serious quality degredation.
> 
> 
> I've got some some questions as a result of my experiments so far:
> 
> 
>    - "-co PHOTOMETRIC=YCBCR" - in gdal_translate this will fail saying it
>    only works with 3 bands. Yet with gdaladdo, compressing overviews with
>    "--config PHOTOMETRIC_OVERVIEW YCBCR" works fine (or at least gives no
>    errors). Any reason for this?

--config PHOTOMETRIC_OVERVIEW YCBCR is ignored if you build internal GTiff 
overview. And I've just tested with external overview and it fails as expected 
:

$ gdaladdo 4band.tif 2 --config COMPRESS_OVERVIEW JPEG --config 
PHOTOMETRIC_OVERVIEW YCBCR -ro
ERROR 6: PHOTOMETRIC_OVERVIEW=YCBCR requires a source raster with only 3 bands 
(RGB)
Overview building failed.


>    - Is there any special compression to use for four band imagery as I
>    can't use YCBCR?

Just base JPEG compression

>    - What's the best way to process the data? I'm using:
> 
> gdal_translate aerial.vrt aerial.tif -of GTiff -co BIGTIFF=YES -co
> 
> > TILED=YES -co blockxsize=512 -co blockysize=512 -co COMPRESS=JPEG -co
> > JPEG_QUALITY=50 -a_srs EPSG:27700
> > gdaladdo aerial.tif -r average --config COMPRESS_OVERVIEW JPEG --config
> > JPEG_QUALITY_OVERVIEW 50 --config INTERLEAVE_OVERVIEW PIXEL --config
> > PHOTOMETRIC_OVERVIEW YCBCR 2 4 8 16 32

As said above, the --config options will be ignored for internal overviews 
(except JPEG_QUALITY_OVERVIEW actually). They will reuse the same setting as 
the full resolution bands

> 
>    - How do I get GDAL to *not *set Band 4 to "Alpha" (which is what the
>    above does).

Add -co ALPHA=UNSPECIFIED

> 
> Using GDAL 1.10.1
> 
> Thanks,
> Jonathan

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list