overlay two surface or mesh plots

조회 수: 17 (최근 30일)
Frank DelRio
Frank DelRio 2019년 3월 12일
편집: Voss 2022년 6월 3일
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

답변 (1개)

Voss
Voss 2022년 6월 3일
편집: Voss 2022년 6월 3일
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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by