[GRASS-user] integration of sample.c algorithms into r.resample

Dylan Beaudette dylan.beaudette at gmail.com
Wed Aug 9 20:34:08 EDT 2006


On Wednesday 09 August 2006 16:51, Glynn Clements wrote:
> Dylan Beaudette wrote:
> > > If you want any other conversion, you have to keep switching regions,
> > > so that input maps are read at their native resolution, while output
> > > maps are written at the desired resolution.
> >
> > Yikes. That does complicate things quite a bit. I wonder if
> > G_get_raster_row() could be modified such that it can perform these three
> > resampling strategies as well. i.e. such that if one wanted a different
> > resampling approach in any function that uses G_get_raster_row(), it
> > would be possible to specify bilinear or cubic convolution... Although
> > this might be a monumental task.
>
> I don't know about "monumental", but it would certainly complicate
> matters. Apart from anything else, interpolation requires keeping
> multiple rows in memory.
>
> Aside from implementation issues, there are semantic issues, e.g. how
> you define the interpolation algorithm near the boundaries of the map
> or if adjoining cells are null.
>
> Also, interpolation is only meaningful for scalar quantities, not for
> discrete categories, and there's no automatic way to distinguish the
> two (at least for CELL maps; floating-point maps should normally
> represent scalar quantities, although they could be category maps
> which have been processed by a module which uses DCELL throughout for
> convenience).

Good points. G_get_raster_row() should probably be left alone then. 

In the mean time, I was hoping to get a general purpose resampling module 
together mostly for access to a cubic convolution interpolation. 

In modifying r.bilinear, I have found that:

1. the output is not quite correct when the region is not aligned to the input 
raster, including edge effects
2.  the original r.bilinear algorithm is an order of magnitude faster than the 
algorithm in sample.c

touching on issue #1 : the output from sample.c , as implemented in this 
modified version of r.bilinear produces results that are very close to the 
original r.bilinear when the region is aligned to the input raster. I have 
attached some additional figures demonstrating this case. 

Perhaps then, a module based on a generic raster module framework which calls 
sample.c would do the trick. However, I am not quite sure how to account for 
edge effects, or a region that is not aligned with the input raster-- the 
code in r.bilinear is a bit too terse for me to grasp. 

Any thoughts / insight would be very helpful.

Cheers,

Dylan

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample_comparison_3.png
Type: image/png
Size: 11243 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20060809/5821ceae/sample_comparison_3.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample_comparison_4.png
Type: image/png
Size: 61650 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20060809/5821ceae/sample_comparison_4.png


More information about the grass-user mailing list