Jpeg to 3D surface
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a bathymetric map in the form of a jpeg image. What I would like to do is import this into Matlab, for Matlab to recognise the colour map and plot a 3D surface of my image. Can anyone describe the best way to do this? I am not a big user of Matlab, I just need to do this one thing for my project.
(I have managed so far to import the image but the axis are all wrong. When I try and change them it changes my image size. I need the image to stay put and to change the values on the scale Then plot a 3d surface of it)
1 comentario
Respuestas (1)
Gautam
el 27 de Ag. de 2024
Hello Pete,
It is difficult to reproduce the problem and address the specific issue in the absence of the data you’re using. However, here are some general ways for adjusting the plot:
1. Adjust the Axis properties: Use “set(gca, 'XLim, ...)” and “set(gca, 'YLim', ...)” to manually set the axis ticks and labels to desired values:
set(gca, "XLim", [-3.0050, -2.9992]);
set(gca, "YLim", [53.4059, 53.4101]);
2. Use “axis” to style the current axis to a predefined style setting the limits and scaling.
3. Make sure that the mapping from pixel coordinates to the plot coordinates reflects the correct dimensions that you defined while importing the data
The below figure shows the cod and the 3D mesh plot of a custom Bathymetric data that is read from a table using the “mesh” function:
D = readtable("data.xlsx");
Lon = D{:,1};
Lat = D{:,2};
Dep = D{:,3};
xLon = linspace(min(Lon), max(Lon), 1E+3);
yLat = linspace(min(Lat), max(Lat), 1E+3);
[X,Y] = meshgrid(xLon, yLat);
zDep = griddata(Lon, Lat, Dep, X, Y);
figure
mesh(X, Y, zDep)
grid on
view(35,25)
title('Mesh Plot')
set(gca, "XLim", [-3.0050, -2.9992]);
set(gca, "YLim", [53.4059, 53.4101]);
For more information on “axis” and setting Axis properties refer to the following documents:
2. “Axis Properties”: https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.axes-properties.html
Hope this helps
0 comentarios
Ver también
Categorías
Más información sobre Red en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!