imageschs is one of the functions that I most frequently use. Admittedly, it has a somewhat non-intuitive name. Yet, the function’s name is simply the concatenation of imagesc, a MATLAB built-in function to display an image with scaled colors, and hs, which abbreviates hillshading. In combination, imageschs displays an image (or GRIDobj) with a shading based on an underlying digital elevation model (DEM).
The syntax of imageschs is quite simple, but there are a number of parameter name/value pairs that you may use to control some additional behavior of the function. The parameter name/value pairs are documented in the help section of the function that can be accessed via
Here I briefly outline some new functionality that I added lately.
1. Median filtering
Smoothing the hillshade has proven successful to reduce the effect of small geographic features on shading, instead emphasizing the larger scale geographic patterns. Many software packages use a median filter and imageschs now does so as well:
ax(1) = subplot(1,2,1); imageschs(DEM,,'colorbar',false) ax(2) = subplot(1,2,2); imageschs(DEM,,'medfilt',true,'colorbar',false)
2. Percent clipping
By default, imageschs linearly scales the color range between the minimum and maximum value of the coloring image or GRIDobj. Sometimes, this range may be strongly affected by just a few extreme values. This is particularly true for curvature, that usually contains values close to zero, but often has few values which are very high or low. The linear scaling inbetween these values entails that all patterns characterized by smaller variations become invisible. imageschs can now remove those values using percentage clipping. That means that the scaling applies only to the value range between the X%’s and 100-X%’s percentile of the data.
C = curvature(DEM); imageschs(DEM,C,'percentclip',2)
3. Make the hillshade permanent
Have you ever been annoyed that imageschs takes a while if you have to call it repeatedly although you always use the same DEM? Now you can use the option ‘usepermanent’ to reduce waiting time. If this option is set to true, imageschs will store the hillshade as a persistent variable and will make it available if the function is called next time. Of course, this will only work out if the DEM (actually, its hillshade) and the coloring matrix or GRIDobj have the same dimensions. And of coarse, beware that any changes that you make to the DEM in the meantime remain disregarded by imageschs.
DEM = resample(DEM,5); DEM = crop(DEM); G = filter(gradient8(DEM),'mean',11); tic;imageschs(DEM,,'usepermanent',true); toc Elapsed time is 3.599666 seconds. tic;imageschs(DEM,G,'usepermanent',true); toc Elapsed time is 0.717102 seconds.
Ok, that’s it about recent changes to imageschs. Please leave a comment or report bugs!