Jpeg to 3D surface

조회 수: 9 (최근 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
Ethan
Ethan 2024년 4월 25일
이동: Walter Roberson 2024년 4월 25일
Sorry pal

댓글을 달려면 로그인하십시오.

답변 (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에서 Color and Styling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by