Multiple colormaps with surface and patch
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all...
My question is a variation on the theme of the use of the multiple colormap on the same figure/axis, but with the additional issue of handling a surface and a patch at the same time...
I have to display an image (an ortophoto) overlapped to a 3D surface (a digital elevation model of the land) and, at the same time a patched section (an isocap) of a volume of a certain variable (the salinity) simulated by a oceanographyc model.
I cannot use the common geoshow or mapshow commands to display the geotiff image because of the 3D view and the need to overlap it on a 3D surface. I have to use the command "surface" with the texturemap option.
So:
Let's load the image:
% Loading ortophoto
[Orto, R, bbox] = geotiffread('.\GIS\Geotiff.tif');
% Convert to index color data to display as a texture map
[Co,map] = rgb2ind(Orto(:,:,1:3),256);
Let's assume that 'Zo' is the surface 3D data, with his corresponding Xo and Yo coordinate grids.
Let's plot the overlapped image on the surface data:
Ort = surface(Xo,Yo,Zo,Co,'FaceColor','texturemap','EdgeColor','none',...
'CDataMapping','direct');
and let's apply the proper colormap.
colormap(map)
Now let's display the section "Ssect" (isocap):
c = patch(Ssect,'FaceColor','interp','EdgeColor','none');
and let's apply its proper colormap:
colormap(hsv)
As known, the last "colormap" command overwrite the first one.
I tried to apply the product support answer http://www.mathworks.es/support/tech-notes/1200/1215.html and the other http://www.mathworks.es/help/techdoc/creating_plots/bqsxy8a-1.html#brdjjbz-1, but they are not directly appliable to patch surface.
I can understand the principle to break the colormap and reserve part of it for one element and part for another one, but I don't know how to do it when facing with a surface and a patch at the same time.
Please note that the first colormap (map) is not a linearly varying standard colormap but a discrete-values colormap deriving from the coding of RGB values of the image.
Thanks in advance
Simone
0 Commenti
Risposte (3)
Bjorn Gustavsson
il 1 Set 2011
Maybe you can circumvent some of your problems with these tools from the file exchange: http://www.mathworks.co.uk/matlabcentral/fileexchange/3777-tcolor-a-fast-pcolor-that-likes-rgb-images http://www.mathworks.co.uk/matlabcentral/fileexchange/7943-freezecolors-unfreezecolors http://www.mathworks.co.uk/matlabcentral/fileexchange/24371-colormap-and-colorbar-utilities-sep-2009
TCOLOR is a tool which replaces pcolor/surf for rgb-images, FREEZECOLORS makes it possible to use multiple colormaps in one figure, and the same capability exists in the COLORMAP-AND-COLORBAR-UTUILITIES.
If the worst comes to the worst maybe you simply have to plot the orto-photo pixel-by-pixel as patches with their facecolor set to the RGB values - unreasonably tedious but shold get the job done.
HTH.
0 Commenti
Walter Roberson
il 1 Set 2011
Is there a particular reason why the geotiff image must be converted to pseudocolor? surface() accepts truecolor (RGB) data for the color property.
0 Commenti
Vedere anche
Categorie
Scopri di più su Blue in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!