[gdal-dev] Anti-Aliasing

Adam Nowacki nowak at xpam.de
Mon Oct 5 11:03:04 EDT 2009


Chris Emberson wrote:
> The rasters do have colour tables applied, that are expressed using RGB 
> values, using gdaldem:
> 75%    107    0    0
> 50%    196    109    27
> 25%    247    195    72
> 0%    252    233    109
> nv    0    0    0 0
> 
> They are not derived from vector data however. I am unsure of your 
> requirement in terms of the source of the raster data. All of the pixel 
> values have been created and either fall between the values of 1-4 or 
> contain no data.
> 
> The commands I am running on the files are:
> gdal_translate -of GTiff -co "TILED=YES" -b 1 -b 1 -b 1 fileA.asc fileB.tif

Upsample fileB.tif here:
gdalwarp -r bilinear -ts newwidth newheight fileB.tif fileB2.tif
Where newwidth and newheight are a few times larger than original.

> gdaldem color-relief fileB.tif rgb.txt fileC.tif -alpha
> gdalwarp -s_srs EPSG:27700 -t_srs EPSG:900913 -r bilinear fileC.tif 
> fileD.tif
> 
> an example of how the bilinear is working (fileD.tif) can be seen in the 
> attached file. I have tried running running the gdalwarp command above 
> prior to gdaldem but this makes little difference.
> 
> TIA,
> Chris
> 
> 
> 
>  > Date: Mon, 5 Oct 2009 16:46:55 +0530
>  > Subject: Re: [gdal-dev] Anti-Aliasing
>  > From: chaitanya.ch at gmail.com
>  > To: chrisemberson at hotmail.com
>  > CC: seth at pricepages.org; gdal-dev at lists.osgeo.org
>  >
>  > Chris,
>  >
>  > The images look like they have a colour table instead of RGB bands.
>  > Also, they seem to be converted from vector to raster. Correct me if I
>  > am wrong.
>  >
>  > Anti aliasing images with colour tables is a little more involved and
>  > depends on the type of result required. Can you provide the source for
>  > these images?
>  >
>  > One method would be to convert the image into RGB, apply bilinear or
>  > any other interpolation method, and convert it back to the colour
>  > table from RGB. If the source is a vector, we can smooth the shapes by
>  > using curves in place of straight lines.
>  >
>  > On Mon, Oct 5, 2009 at 3:59 PM, Chris Emberson
>  > <chrisemberson at hotmail.com> wrote:
>  > > Seth,
>  > >
>  > > Thanks for the reply. The attached image hopefully will clarify the 
> problem
>  > > I am having. On the left of the image is the output I would like (I 
> have
>  > > produced this using a GIS). On the right is the output using mapnik and
>  > > gdal. The problem is the pixellated effect between the raster 
> values on the
>  > > RHS.
>  > >
>  > > The GIS isn't that great as far as batch processing is concerned, 
> hence why
>  > > I am trying to use the GDAL utilities that ship with mapnik. The 
> option in
>  > > the GIS that produces the desired effect is "anti-aliasing (bilinear
>  > > interpolation)", but it appears as though there is a more sophisticated
>  > > smoothing algorithm being employed? I have tried running the various
>  > > interpolation techniques with gdalwarp but none of them produce a crisp
>  > > output. I have tried also increasing the resolution of the raster by 5x
>  > > (both width and height) using "gdal_translate" and  "-outsize 500% 
> 500%"
>  > > this doesn't help either.
>  > >
>  > > Any suggestions gratefully received,
>  > >
>  > > Chris
>  > >
>  > >
>  > >
>  > >
>  > >> Date: Fri, 2 Oct 2009 12:36:24 -0500
>  > >> Subject: Re: [gdal-dev] Anti-Aliasing
>  > >> From: seth at pricepages.org
>  > >> To: chrisemberson at hotmail.com
>  > >> CC: gdal-dev at lists.osgeo.org
>  > >>
>  > >> Could you give an example of the problem? Anti-aliasing generally only
>  > >> applies when you are going from vector line drawings to rasterized 
> images.
>  > >>
>  > >> If I was trying to smooth things I would first look at cubic or 
> bilinear.
>  > >> Any other resampling may enhance any noise in your image.
>  > >> ~Seth
>  > >>
>  > >> On Fri, October 2, 2009 11:16 am, Chris Emberson wrote:
>  > >> >
>  > >> > I am looking for an anti-aliasing function to smooth out the 
> pixellated
>  > >> > effect between raster values. I have tried the various interpolation
>  > >> > methods with gdalwarp and have also increased the resolution of the
>  > >> > raster
>  > >> > to try and minimise the effect, to no avail.
>  > >> > Is this a function to be added soon?
>  > >> >
>  > >> > Thanks,
>  > >> > Chris
>  > >> >
>  > >> > _________________________________________________________________
>  > >> > Share your photos with Windows Live Photos – Free.
>  > >> >
>  > >> > 
> http://clk.atdmt.com/UKM/go/134665338/direct/01/_______________________________________________
>  > >> > gdal-dev mailing list
>  > >> > gdal-dev at lists.osgeo.org
>  > >> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>  > >>
>  > >>
>  > >
>  > > ________________________________
>  > > New! Receive and respond to mail from other email accounts from within
>  > > Hotmail Find out how.
>  > > _______________________________________________
>  > > gdal-dev mailing list
>  > > gdal-dev at lists.osgeo.org
>  > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>  > >
>  >
>  >
>  >
>  > --
>  > Best regards,
>  > Chaitanya kumar CH.
> 
> ------------------------------------------------------------------------
> Add other email accounts to Hotmail in 3 easy steps. Find out how. 
> <http://clk.atdmt.com/UKM/go/167688463/direct/01/>
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list