[Gdal-dev] Overviews questions

Frank Warmerdam warmerdam at pobox.com
Tue Mar 21 11:21:20 EST 2006


Jeff L. wrote:
> Thanks Frank for your response and your insights.
> 
> So one need to build overviews for all the bands if the used overview 
> format is tiff: Ok.
> 
> I'm still a bit unclear about the internal storage of the overviews 
> within a tiff. You mentioned that an overview .ovr file is a 'normal' 
> image. Does is have any 'normal' bands (full resolution) or only reduced 
> resolutions ? Can you please explain ? (If i run a 'gdalinfo' on an .ovr 
> it stated that it has one band with attached overviews).

Jeff,

In the .ovr file all image directories will be marked as reduced
resolution images.  But if you were to run gdal tools on it they will
treat the first encountered image as the "base full res image" I think.

I would encourage you to run "tiffinfo" on the .ovr file to see it's
structure in more detail.

> Once an .ovr file is created and the base file (.bmp for instance) is 
> opened programmatically, there is a check for the .ovr file existence. 
> If the .ovr is found how we get the overview count (number of overviews) 
> for each band ? (Will it be the same for all the bands ?) Is it stored 
> with the .ovr or we deduce it (example: base dataset has 3 bands and the 
> .ovr has 12 'bands' --> 12/3 : 4 overviews for each band ?).

Through the GDAL API you would call GetOverviewCount() on the GDALRasterBand
to find out how many overviews there are available, and GetOverview(int)
to fetch them.  If the overviews are stored in TIFF format, all bands
will have the same number of overviews.

> Last question: how the overviews are stored within the tiff ? From your 
> response I understood
> that there will a be a set of 'images' within the tiff. Every image 
> correspond to an overview level and has all the bands. To simplify the 
> picture, this would look like:
> 
> image1:
>  overview level 1 for band1
>  overview level 1 for band2
>  overview level 1 for band3
>  .... overview level 1 for last band
> 
> image2:
> overview level 2 for band1
> overview level 2 for band2
> overview level 2 for band3
> .....
> 
> Where level 1 can be 2, 4, 6 or any even number
> 
> Please correct if this schema is not correct.
> 
> Sorry about asking many questions as I'm trying to understand the 
> details about 'overviews' within GDAL.

chmod a-w base.tif
gdaladdo base.tif 2 4
warmerda at gdal2200[160]% ls -l base*
-r--r--r--  1 warmerda users 787570 Mar 21 11:19 base.tif
-rw-r--r--  1 warmerda users 246236 Mar 21 11:20 base.tif.ovr
tiffinfo base.tif.ovr
TIFF Directory at offset 0x8 (8)
   Subfile Type: reduced-resolution image (1 = 0x1)
   Image Width: 256 Image Length: 256
   Tile Width: 128 Tile Length: 128
   Bits/Sample: 8
   Sample Format: unsigned integer
   Compression Scheme: None
   Photometric Interpretation: RGB color
   Samples/Pixel: 3
   Planar Configuration: separate image planes
TIFF Directory at offset 0x116 (278)
   Subfile Type: reduced-resolution image (1 = 0x1)
   Image Width: 128 Image Length: 128
   Tile Width: 128 Tile Length: 128
   Bits/Sample: 8
   Sample Format: unsigned integer
   Compression Scheme: None
   Photometric Interpretation: RGB color
   Samples/Pixel: 3
   Planar Configuration: separate image planes


So, there are two overview levels, so there are two "image directories".
Each image directory has 3 bands (samples/pixel:3).

Hopefully this makes it more clear.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list