[gdal-dev] VRT KernelFilteredSource and overviews

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] VRT KernelFilteredSource and overviews

jratike80

Hi,

 

I was playing with kernel filters in VRT and using this really applies sharpen filter on-the-fly when looking the image at native resolution with QGIS:

 

<VRTRasterBand dataType="Byte" band="1">

    <ColorInterp>Red</ColorInterp>

    <KernelFilteredSource>

      <SourceFilename relativeToVRT="1">image.tif</SourceFilename>

      <SourceBand>1</SourceBand>

      <SourceProperties RasterXSize="12000" RasterYSize="12000" DataType="Byte" BlockXSize="12000" BlockYSize="1" />

      <SrcRect xOff="0" yOff="0" xSize="12000" ySize="12000" />

      <DstRect xOff="0" yOff="0" xSize="12000" ySize="12000" />

        <Kernel normalized="0">

          <Size>3</Size>

           <Coefs>0 -1 0 -1 5 -1 0 -1 0</Coefs>

  </Kernel>

    </KernelFilteredSource>

  </VRTRasterBand>

 

However, filter is not applied to overviews which means that image looks different when I zoom out. Is this the intended behavior?

 

-Jukka Rahkonen-


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: VRT KernelFilteredSource and overviews

Even Rouault-2

On mercredi 4 octobre 2017 11:11:28 CEST Rahkonen Jukka (MML) wrote:

> Hi,

>

> I was playing with kernel filters in VRT and using this really applies

> sharpen filter on-the-fly when looking the image at native resolution with

> QGIS:

>

> <VRTRasterBand dataType="Byte" band="1">

> <ColorInterp>Red</ColorInterp>

> <KernelFilteredSource>

> <SourceFilename relativeToVRT="1">image.tif</SourceFilename>

> <SourceBand>1</SourceBand>

> <SourceProperties RasterXSize="12000" RasterYSize="12000"

> DataType="Byte" BlockXSize="12000" BlockYSize="1" /> <SrcRect xOff="0"

> yOff="0" xSize="12000" ySize="12000" />

> <DstRect xOff="0" yOff="0" xSize="12000" ySize="12000" />

> <Kernel normalized="0">

> <Size>3</Size>

> <Coefs>0 -1 0 -1 5 -1 0 -1 0</Coefs>

> </Kernel>

> </KernelFilteredSource>

> </VRTRasterBand>

>

> However, filter is not applied to overviews which means that image looks

> different when I zoom out. Is this the intended behavior?

 

I guess not from a user point of view. But looking at the code, I see:

 

/* -------------------------------------------------------------------- */

/* For now we don't support filtered access to non-full */

/* resolution requests. Just collect the data directly without */

/* any operator. */

/* -------------------------------------------------------------------- */

if( nBufXSize != nXSize || nBufYSize != nYSize )

{

return VRTComplexSource::RasterIO( nXOff, nYOff, nXSize, nYSize,

pData, nBufXSize, nBufYSize,

eBufType, nPixelSpace, nLineSpace,

psExtraArg );

}

 

(which means that over-sampling will also not apply the kernel)

 

 

So seems the issue is "known". Probably that documenting this limitation should be done for now.

Doc source is in frmts/vrt/vrt_tutorial.dox

 

Even

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev