Jpeg to 3D surface
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (1)
Gautam
am 27 Aug. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Color and Styling 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!