<div dir="ltr">Hello Jan,<div><br></div><div>There hasn't been a lot of response to your question, so I take the liberty to give you my thoughts, for what they are worth.</div><div><br><div>My first guess was that you need something like a <a href="http://en.wikipedia.org/wiki/Bilateral_filter" target="_blank">bilateral filter</a>. Noise (detail) reduction is combined with edge preservation (readability). If so, the code is quite simple and parameters can be used to optimize results. It would have to be combined with a filter reducing the number of pixels.</div>
<div>I'm not too sure about a (more or less) complete set of filters, i.e. there's a lot of filters and I am not familiar with what might be thought of as a complete set (gimp and image magick could be used as a source, probably). However, see below, 'imageworsener'.</div>
<div><br></div><div>Maybe a test tile could serve to do a few tests. After that, I can take a look at the work needed to incorporate filters in a fairly general way to allow adding more filters.</div><div>Completely general appears unlikely and quite a strain on parameter passing, documentation, support.</div>
<div><br></div><div>I've been reading up a bit on the subject of image downsampling / upsampling. There is plenty afoot which might make you consider a different approach from using a set of images, like <a href="http://www.cs.huji.ac.il/~danix/epd/" target="_blank">this paper on multiscale edge preserving</a> as part of a <a href="http://www.stanford.edu/class/cs448f/lectures/" target="_blank">stanford course</a> on filtering/image manipulation.</div>
<div><br></div><div>There is signalprocessing analog with (down)sampling audio which would separate low from high frequency signals and recombine them depending on the required scale.</div><div>Don't know if that could be done continuously instead of just for integral pixel reductions.</div>
<div>Would be great if this can be done in a server, perhaps using graphics cards to speed up the image (re)construction.</div><div><br></div><div style>There is public domain program on the subject, called <a href="http://entropymine.com/imageworsener/">imageworsener</a>. There are a lot of considered options, and source code. So this might be a point of departure, either by incorporating it into gdal(warp), or vice versa.</div>
<div style><br></div><div style>Hope this helps some,</div><div>Best regards,</div><div>Jan<br>
<br><div class="gmail_quote">On Thu, Mar 28, 2013 at 12:27 PM, Jan Hartmann <span dir="ltr"><<a href="mailto:j.l.h.hartmann@uva.nl" target="_blank">j.l.h.hartmann@uva.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<font face="Times New Roman, Times, serif">Perhaps I should clarify
a bit what I meant, I haven't had any reactions until now,
positive or negative, and it is important for me.<br>
<br>
I use Gdalwarp and gdaladdo extensively for goereferencing and
tiling large historical maps serieses (raster scans). To display
them efficiently, I need to create layers at different scale
levels, e.g. if the original maps have a pixel size of 10 meters,
I need to resample them to rasters with pixel sizes of 20, 40, 80
, 160, 320 and 640 meters, and tile all those maps appropriately.
So the original maps have to be resampled quite drastically. In
Gdalwarp there is no adequeate resampling algorithm, and you end
up with very grainy map at those lower resolutions. Gdaladdo has
several more algorithms, with gauss in many cases the most
efficient. However, even with the gauss filter, maps resampled at
very low resolutions turn out too hazy. For an example see the 1930
map of the Netherlands:<br>
<br>
</font><font face="Times New Roman, Times, serif">
<a href="http://mapserver.sara.nl/topo/triang/" target="_blank">http://mapserver.sara.nl/topo/triang/</a><br>
<br>
If you zoom in to more detailed levels, you'll see the way the
image sharpens. For the effect on black-white image choose the
TMK-map (1850) with the top-center button. Filters like "unsharp
mask" would perform much better in these cases.<br>
<br>
So I would like to propose two enhancements to gdal:<br>
<br>
- add additional filters to gdalwarp, gauss and the filters
mentioned below.<br>
- implement more filters for gdalwarp and gdaladdo, e.g. "unsharp
mask", or the "mode" filter asked by Jack below. Perhaps even add
the possibility to specify parameters, like in ImageMagick<br>
<br>
I don't know how difficult is, and whether the gdal devs would
find this really an improvement for gdal. I could do this with
some ImageMagick or Gimp scripts, but it would be a kludge. As we
are going to georeference the complete cadastral and topographical
map base of the Netherlands from 1832 to 1994 the next few years
(millions of map-scans), this exentsion of gdal would come in very
handy. And funding it will really be no problem at all.<br>
<br>
I would appreciate any kind of comment on this, positive or
negative.<br>
<br>
Regards,<br>
<br>
Jan<br>
<br>
Dr. J. Hartmann<br>
Department of Geography<br>
University of Amsterdam <br>
<br>
</font><div><div>
<div>On 03/27/2013 10:13 PM, John Twilley
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I'm interested in this feature request as well.
Adding the mode resampling algorithm to gdalwarp would be very
beneficial to my projects, right up there with being able to
access the warp API from Python. Is this at all possible?
Should I submit a feature request on Trac, or what? Just let
me know!
<div>
<br>
</div>
<div>Jack.</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>-- <br>
mathuin at gmail dot com</div>
<br>
<br>
<div class="gmail_quote">On Mon, Feb 18, 2013 at 8:17 AM, Jan
Hartmann <span dir="ltr"><<a href="mailto:j.l.h.hartmann@uva.nl" target="_blank">j.l.h.hartmann@uva.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> <br>
<div> <font face="Times New Roman, Times, serif">Hi devs,<br>
<br>
Would it be possible to add gauss and other
interpolations to gdalwarp? At the moment I
georeference large scans to 2000*2000 tiles at the
most detailed scale, and then create 2000*2000 tiles
at resolutions of 2, 4 6 etc times the original
scale, using gdaladdo and gauss or other
interpolations. It would help immensely if I could do
that directly with gdalwarp.
<div><br>
<br>
Funding would probably no problem. The question is:
can and should it be done?<br>
<br>
Jan <br>
</div>
</font> <br>
</div>
<br>
</div>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br></div>
</div></div>