Jpeg to 3D surface

6 次查看(过去 30 天)
Pete
Pete 2012-3-20
回答: Gautam 2024-8-27
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 个)

Gautam
Gautam 2024-8-27
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:
Hope this helps

类别

Help CenterFile Exchange 中查找有关 Red 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by