Changeset 22291


Ignore:
Timestamp:
12/05/17 16:18:31 (7 years ago)
Author:
jbondzio
Message:

ADD:adding shaded option for use with googlemaps plotting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plot_googlemaps.m

    r21828 r22291  
    8585image_rgb = ind2rgb(uint16((data_grid - data_min)*(length(colorm)/(data_max-data_min))),colorm);
    8686
     87if exist(options,'shaded'),
     88        a    = -45;
     89        scut = 0.2;
     90        c    = 1;
     91        % computes lighting from elevation gradient
     92        [fx,fy] = gradient(data_grid,x_m,y_m);
     93        fxy = -fx*sind(a) - fy*cosd(a);
     94        clear fx fy % free some memory...
     95        fxy(isnan(fxy)) = 0;
     96
     97        % computes maximum absolute gradient (median-style), normalizes, saturates and duplicates in 3-D matrix
     98        r = repmat(max(min(fxy/nmedian(abs(fxy),1 - scut/100),1),-1),[1,1,3]);
     99
     100        % applies contrast using exponent
     101        rp = (1 - abs(r)).^c;
     102        image_rgb = image_rgb.*rp;
     103
     104        % lighter for positive gradient
     105        k = find(r > 0);
     106        image_rgb(k) = image_rgb(k) + (1 - rp(k));
     107end
     108
    87109alpha=ones(size(data_grid));
    88110alpha(find(~data_nan))=transparency;
Note: See TracChangeset for help on using the changeset viewer.