overlay two surface or mesh plots

6 visualizzazioni (ultimi 30 giorni)
Frank DelRio
Frank DelRio il 12 Mar 2019
Modificato: Voss il 3 Giu 2022
Hi everyone,
I would like to overlay two surface or mesh plots, both of which are attached here. The first mesh plot (black and white) represents the topography of a surface, and the second mesh plot (red and white) represents the local curvature of the surface.
Basically, I would like to overlay the curvature data onto the topography data, but with the transparency of the curvature data varying from transparent for the white regions to opaque for the red regions (such that only the red data appears on the black and white mesh plot).
If varying the transparency of the curvature data is too difficult, another option would be to define a threshold value for curvature, and then overlay anything above that threshold onto the topography data. Thanks in advance for the help!
Frank

Risposte (1)

Voss
Voss il 3 Giu 2022
Modificato: Voss il 3 Giu 2022
topography = imread('topography.jpg');
curvature = imread('curvature.jpg');
% attempting to crop axes and labels from images.
% you can omit this if you start with the actual
% image data, rather than images of MATLAB figures.
topography = topography(70:640,125:790,:);
curvature = curvature(70:640,125:790,:);
% initial images, for reference
figure()
subplot(1,2,1)
imshow(topography)
subplot(1,2,2)
imshow(curvature)
% overlaid images
figure()
im_topography = image('CData',topography);
hold on
red_val = double(curvature(:,:,1));
min_red_val = min(red_val(:));
max_red_val = max(red_val(:));
transparency = (red_val-min_red_val)/(max_red_val-min_red_val);
im_curvature = image('CData',curvature,'AlphaData',1-transparency);
set(gca(),'YDir','reverse')
axis off

Prodotti


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by