Opened 8 years ago

Closed 5 years ago

#6557 closed defect (wontfix)

GDALResampleChunk32R_Gauss should use optimal antialiasing kernel

Reported by: wkarel Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: GDAL_Raster Version: 2.1.0
Severity: normal Keywords:
Cc:

Description

GDALResampleChunk32R_Gauss uses the following 3x3 kernel for scale factors of up to 2:

1,2,1,
2,4,2,
1,2,1

While this kernel would be optimal (for the purpose of antialiasing) for a scale factor of sqrt(2), it is not for the common scale factor of 2 commonly used to build overviews (hierarchically). For a scale factor of 2, the 5x5 kernel defined in GDALResampleChunk32R_Gauss would be optimal, but is not used in that case, unfortunately. As there is no way to force usage of a certain kernel, I consider this a bug - specifically, because in ticket #2137, the main purpose of implementing the Gaussian filter was antialiasing.

Interestingly, it seems that the source data read by GDALRegenerateOverviewsMultiBand seems to already consider this, as it multiplies nKernelRadius (which is 1 for GAUSS) with nOvrFactor. Hence, only the choice of kernel in GDALResampleChunk32R_Gauss would need to be changed:

if(nResYFactor <= 2 )
{
  panGaussMatrix = anGaussMatrix5x5;
  nGaussMatrixDim=5;
}

For the optimal standard deviation of a Gaussian kernel for downsampling by a factor of 2, see e.g. Lowe, 2004: "Distinctive Image Features from Scale-Invariant Keypoints" or the OpenCV-documentation on pyrDown: http://docs.opencv.org/3.1.0/d4/d86/group__imgproc__filter.html#gaf9bba239dfca11654cb7f50f889fc2ff

Change History (1)

comment:1 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.