2D image surf to 3D-plot

조회 수: 7 (최근 30일)
Mac Tavish
Mac Tavish 2018년 6월 2일
댓글: agung pratama 2020년 7월 21일
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
jonas
jonas 2018년 6월 2일
What do you have on your z-axis?
Mac Tavish
Mac Tavish 2018년 6월 3일
You mean what's that or z axis dimension? z axis dimension is 15 mm

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

채택된 답변

jonas
jonas 2018년 6월 2일
편집: jonas 2018년 6월 2일
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
Mac Tavish
Mac Tavish 2018년 6월 3일
Perfect! It's really helpful ,you are so kind. Thank you Walter!
agung pratama
agung pratama 2020년 7월 21일
Is fig1 use a noise rremoval? and what is that?

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by