Clear Filters
Clear Filters

How do I extract an entire 3D graph from MATLAB?

1 view (last 30 days)
Hello everyone!
I'm working on a Augmented Reality project and I need to use a 3D graph from MATLAB in another software. This graph has the same geometry of the front surface of a physical curved object, i.e. a sector of cylinder. I explain my goal:
when I target the sector of cylinder with a camera, I want my 3D Graph/map appears on its surface in AR as a skin or a texture.
So I'd like to know if there is a way to extract the entire map, in order to use it in anyway I want.
I thank you in advance for your help!

Answers (1)

Star Strider
Star Strider on 15 Dec 2021
I’m not exactly certain what the desired result is, however in a surf plot for example, the surface object hass the information —
[X,Y,Z] = peaks;
figure
hs = surf(X, Y, Z) % Create Handle To 'surface' Object
hs =
Surface with properties: EdgeColor: [0 0 0] LineStyle: '-' FaceColor: 'flat' FaceLighting: 'flat' FaceAlpha: 1 XData: [49×49 double] YData: [49×49 double] ZData: [49×49 double] CData: [49×49 double] Show all properties
grid on
So for example to get the ‘ZData’ matrix —
Z_surf = hs.ZData
Z_surf = 49×49
0.0001 0.0001 0.0002 0.0004 0.0007 0.0011 0.0017 0.0025 0.0034 0.0043 0.0051 0.0052 0.0042 0.0010 -0.0050 -0.0151 -0.0299 -0.0500 -0.0752 -0.1049 -0.1373 -0.1703 -0.2010 -0.2268 -0.2450 -0.2539 -0.2527 -0.2419 -0.2228 -0.1976 0.0001 0.0002 0.0004 0.0006 0.0010 0.0017 0.0026 0.0037 0.0051 0.0064 0.0073 0.0070 0.0046 -0.0013 -0.0123 -0.0299 -0.0555 -0.0898 -0.1327 -0.1828 -0.2373 -0.2924 -0.3437 -0.3862 -0.4161 -0.4302 -0.4276 -0.4087 -0.3761 -0.3332 0.0002 0.0003 0.0005 0.0009 0.0016 0.0025 0.0038 0.0055 0.0074 0.0091 0.0101 0.0091 0.0045 -0.0059 -0.0244 -0.0537 -0.0959 -0.1520 -0.2217 -0.3028 -0.3908 -0.4795 -0.5616 -0.6296 -0.6769 -0.6989 -0.6937 -0.6625 -0.6090 -0.5392 0.0002 0.0004 0.0008 0.0014 0.0023 0.0036 0.0055 0.0079 0.0105 0.0128 0.0138 0.0116 0.0037 -0.0131 -0.0427 -0.0889 -0.1549 -0.2425 -0.3510 -0.4767 -0.6130 -0.7502 -0.8769 -0.9816 -1.0541 -1.0873 -1.0784 -1.0292 -0.9456 -0.8368 0.0003 0.0006 0.0011 0.0019 0.0032 0.0051 0.0077 0.0110 0.0147 0.0178 0.0188 0.0150 0.0028 -0.0227 -0.0671 -0.1362 -0.2346 -0.3648 -0.5260 -0.7127 -0.9150 -1.1186 -1.3066 -1.4619 -1.5692 -1.6183 -1.6047 -1.5311 -1.4063 -1.2440 0.0004 0.0008 0.0015 0.0026 0.0044 0.0070 0.0106 0.0151 0.0201 0.0244 0.0257 0.0204 0.0031 -0.0328 -0.0955 -0.1931 -0.3322 -0.5166 -0.7450 -1.0101 -1.2975 -1.5872 -1.8552 -2.0768 -2.2305 -2.3012 -2.2825 -2.1782 -2.0008 -1.7696 0.0005 0.0010 0.0019 0.0034 0.0058 0.0093 0.0141 0.0203 0.0272 0.0333 0.0357 0.0294 0.0074 -0.0396 -0.1224 -0.2521 -0.4382 -0.6860 -0.9942 -1.3531 -1.7436 -2.1385 -2.5050 -2.8095 -3.0220 -3.1215 -3.0991 -2.9593 -2.7192 -2.4049 0.0007 0.0013 0.0024 0.0043 0.0073 0.0118 0.0182 0.0266 0.0361 0.0451 0.0500 0.0445 0.0197 -0.0364 -0.1379 -0.2995 -0.5340 -0.8491 -1.2440 -1.7066 -2.2129 -2.7277 -3.2083 -3.6104 -3.8941 -4.0312 -4.0090 -3.8328 -3.5242 -3.1175 0.0007 0.0015 0.0028 0.0051 0.0088 0.0145 0.0227 0.0337 0.0468 0.0603 0.0698 0.0684 0.0452 -0.0146 -0.1285 -0.3154 -0.5921 -0.9694 -1.4478 -2.0139 -2.6390 -3.2799 -3.8835 -4.3937 -4.7596 -4.9441 -4.9299 -4.7220 -4.3468 -3.8464 0.0008 0.0015 0.0030 0.0056 0.0100 0.0168 0.0270 0.0410 0.0588 0.0785 0.0959 0.1035 0.0888 0.0350 -0.0791 -0.2766 -0.5790 -1.0012 -1.5465 -2.2015 -2.9344 -3.6950 -4.4203 -5.0422 -5.4980 -5.7407 -5.7466 -5.5195 -5.0892 -4.5057
.
  4 Comments
Giorgio Morello
Giorgio Morello on 17 Dec 2021
Thank you for your answer, I'll let you know if I can!
Star Strider
Star Strider on 17 Dec 2021
My pleasure!
I very much hope it works!
If it does not, and since no one else responded to this, if there are problems, use the Contact Support option and then please post back here with the solution MathWorks provides. In the request, include the URL of this thread so that it will not be necessary to repeat everything, and MathWorks has the posted information and knows what has already been attempted.
.

Sign in to comment.

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!