How to visualize two images in two intersecting planes?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
yousef Yousef
am 10 Dez. 2022
Kommentiert: yousef Yousef
am 15 Dez. 2022
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Dez. 2022
3 Kommentare
Walter Roberson
am 15 Dez. 2022
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!