I have a giant GeoTIFF I'd like to convert to grayscale and add a gaussian blur to. As far as I know, GDAL can strip two of the three color bands and call it grayscale, which might work, but is there a better way? Imagemagick has both grayscale and gaussian blur functionality, but can not process georeferenced TIFFs (as far as I know). Any suggestions how I should go about doing this?
|
GDAL has a wonderful file format called VRT, which is an XML wrapper around one or more raster files. One feature of VRTs is their ability to encode square convolution kernels for any given band. It does involve playing around with XML in a text editor (or programatically), but if you're already used to the GDAL tools, it shouldn't be too hard. To illustrate, I took this image of some Ordnance Survey data from around the old OS building in Southampton:
And ran gdalbuildvrt to generate an initial VRT file:
Then I replaced the
Then ran gdal_translate to convert to a TIFF:
Which gives me this image:
With its georeferencing data intact. For the greyscale part, I suggest you use Quantum GIS and its good (if currently slightly quirky) Raster Calculator. Simply load up your blurred image, select
Loading that image into QGIS, gives me:
Other coefficients can be used for the greyscale conversion, but those are a good starting point. Also, it shouldn't matter whether you blur first then reduce, or the other way round. |
|||||||
|
|
You're right, you'll lose georeferencing information when you process GeoTIFF in most 3rd party packages. One way of extracting the world georeferencing information from a GeoTIFF:
Another way, is to use ArcCatalog convert the GeoTIFF into another Raster format, say, BMP, which forces the creation of the World file (usually .bpw) and the Auxiliary file containing projection (usually .aux.xml). You can discard the BMP itself but keep these additional files so that you can reapply them for your TIFF image. |
||||
|
|


