Jpeg to 3D surface

7 vues (au cours des 30 derniers jours)
Pete
Pete le 20 Mar 2012
Réponse apportée : Gautam le 27 Août 2024
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 commentaire
Ethan
Ethan le 25 Avr 2024
Déplacé(e) : Walter Roberson le 25 Avr 2024
Sorry pal

Connectez-vous pour commenter.

Réponses (1)

Gautam
Gautam le 27 Août 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:
Hope this helps

Catégories

En savoir plus sur Color and Styling dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by