[mkgmap-dev] DEM: performance with bicubic interpolation
From Andrzej Popowski popej at poczta.onet.pl on Wed Jan 24 12:45:02 GMT 2018
Hi, I have added more algorithms for testing, patch is attached. Patched mkgmap recognize following values for x-dem-interpolation: bilinear bicubic bicubic-spline bicubic-catmull bicubic-hermite I have prepared new set for testing: http://files.mkgmap.org.uk/download/408/interpolation2.7z For me bicubic-catmull looks like bicubic. Bicubic-spline looks inferior and bicubic-hermite gives weird results, maybe something is wrong. Still bicubic interpolation looks the best. -- Best regards, Andrzej -------------- next part -------------- Index: src/uk/me/parabola/mkgmap/build/MapBuilder.java =================================================================== --- src/uk/me/parabola/mkgmap/build/MapBuilder.java (revision 4081) +++ src/uk/me/parabola/mkgmap/build/MapBuilder.java (working copy) @@ -227,6 +227,12 @@ case "bicubic-spline": demInterpolationMethod = InterpolationMethod.BicubicSpline; break; + case "bicubic-catmull": + demInterpolationMethod = InterpolationMethod.BicubicCatmull; + break; + case "bicubic-hermite": + demInterpolationMethod = InterpolationMethod.BicubicHermite; + break; case "bilinear": demInterpolationMethod = InterpolationMethod.Bilinear; break; Index: src/uk/me/parabola/mkgmap/reader/hgt/HGTConverter.java =================================================================== --- src/uk/me/parabola/mkgmap/reader/hgt/HGTConverter.java (revision 4081) +++ src/uk/me/parabola/mkgmap/reader/hgt/HGTConverter.java (working copy) @@ -47,10 +47,11 @@ private int statRdrNull; private int statRdrRes; private InterpolationMethod interpolationMethod = InterpolationMethod.Bicubic; + private double[][] interpolationMatrix = Cubic.BSPLINE; public enum InterpolationMethod { - Bilinear, Bicubic, BicubicSpline + Bilinear, Bicubic, BicubicSpline, BicubicCatmull, BicubicHermite }; /** @@ -139,7 +140,7 @@ if (InterpolationMethod.Bicubic.equals(interpolationMethod)) { h = (short) Math.round(bicubicInterpolation(eleArray, qx, qy)); } else { - Cubic interpolator = new Cubic(Cubic.BSPLINE, eleArray); + Cubic interpolator = new Cubic(interpolationMatrix, eleArray); h = (short) Math.round(interpolator.eval(qx, qy)); } statBicubic++; @@ -675,5 +676,17 @@ public void setInterpolationMethod(InterpolationMethod interpolationMethod) { this.interpolationMethod = interpolationMethod; + switch (interpolationMethod) { + case BicubicCatmull: + this.interpolationMatrix = Cubic.CATMULL_ROM; + break; + case BicubicHermite: + this.interpolationMatrix = Cubic.HERMITE; + break; + case BicubicSpline: + default: + this.interpolationMatrix = Cubic.BSPLINE; + break; + } } }
- Previous message: [mkgmap-dev] DEM: performance with bicubic interpolation
- Next message: [mkgmap-dev] DEM: performance with bicubic interpolation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list