2D image surf to 3D-plot
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mac Tavish
am 2 Jun. 2018
Kommentiert: agung pratama
am 21 Jul. 2020
HI,i'm the beginner of the matlab ,i have a lot of grayscale image like fig1 ,and i want matlab loads this images and surf to the 3d-plot like fig2 , how should i do ? i try using surf()function but it doesn't work.
2 Kommentare
Akzeptierte Antwort
jonas
am 2 Jun. 2018
Bearbeitet: jonas
am 2 Jun. 2018
Perhaps you are trying to pass a color image to surf, which does not work. Note that if you load a grayscale image, it will still be represented as RBG. Therefore you will have to first convert the image to grayscale.
A=imread('fig1.jpg');
B = rgb2gray( A );
surf(B,'edgecolor','none')
%optional
colormap(gray)
Note that x- and y-axis are pixel positions, as no dimensions were provided.
6 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

