How to visualize two images in two intersecting planes?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I have two images. I need to visualize these images in a way each image will be on a different plane. I'm wondering if this is achievable using MATLAB or any other tool. Pleas have a look at the attached image.
Any help will be appreciated.
Thank you
댓글 수: 4
채택된 답변
Walter Roberson
2022년 12월 10일
댓글 수: 3
Walter Roberson
2022년 12월 15일
Those are not images -- not unless you render the scatter() into a buffer or save it to an image file and read the image out of the file. And even then you only have one of them, since your second x is the same as the first one.
If you have two plots that you want to put into different planes, then the easiest way is to use plot3() or scatter3()
x1 = linspace(0,3*pi,200);
y1 = cos(x1) + rand(size(x1));
z1 = zeros(size(x1));
x2 = x1;
y2 = zeros(size(x2));
z2 = x2 .^ 2 - sin(x2);
subplot(2,1,1);
plot3(x1, y1, z1, 'k*', x2, y2, z2, 'b+')
title('plot3 version')
subplot(2,1,2)
scatter3(x1, y1, z1, 'k*');
hold on
scatter3(x2, y2, z2, 'b+');
hold off
title('scatter3 version')
Are there other approaches? Yes. You can use the following kind of sequence:
- create one 2d plot normally, using scatter() or plot.
- use hgtransform to create a transform group.
- create your second 2d plot, but pass in the handle of the transform group as the 'parent' or as the axes (first parameter) to plot against;
- set the Matrix property of the transform group to the rotation / translation / scaling matrix that will act to transform the second plot into the desired location. The makehgtform function is very useful for creating appropriate Matrix. Just remember that the rightmost transform you pass to makehgtform is the one that is executed first
Warning: do not use this sequence to try to rotate an image() object out of the XY plane. image() objects are 2D objects with no thickness, and if you rotate them out-of-plane then they effectively vanish down to a line. To get an image() object to show up outside the XY plane, you need to create a surface object and texture-map the image to the surface. The easiest way to do that is to use warp
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!