简体   繁体   中英

Matlab: How to obtain 3d image from grayscale gradient

I have a 2D microscopical image of a surface in grayscale. Now I want to plot this in 3d transforming the gradient from the image into height (by integration I thought). Trying 2d-integration of grdx&grdy didn't produce any useful results.

Which way would you suggest to do that? I'm not so familiar with the different ways of plotting and whether to use imgradient and somehow combine Gmag and Gdir or to use imgradientxy and combine Gx and Gy(is the magnitude here already in the matrix of Gx,y?).

Any help is appreciated - thank you very much!

What does this do for you?

a is the path to your image.

[b,c] = imgradient(a);
surf(b);

edit:

a1 = imread('LnoL6wJ.png');
a = a1(:,:,3); 
[b,c] = imgradient(a);
h = surf(b);
set(h, 'edgecolor','none')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM