Display 2-D grayscale image with vector normal arrows

3 vues (au cours des 30 derniers jours)
Ken
Ken le 23 Août 2011
I have a 2-D grayscale image of a macroscopically flat surface. On a much smaller scale, the surface has regular variations in its surface normal. Is there a way to display the 2-D grayscale image in a 3-d plot while having quiver3 (or something similar) display the local surface normals?
Any help is appreciated!
ken.

Réponse acceptée

Sean de Wolski
Sean de Wolski le 23 Août 2011
Yes. Use, slice to plot your image and then overlay the quiver3 on it. Quick example:
I = double(repmat(imread('cameraman.tif'),[1 1 2]));
%slice requires double precision at least two in each dimension
H = slice(I,[],[],1);
colormap(gray(256)); %8bit color scheme
set(H,'EdgeColor','none') %required so image isn't just an edge
hold on %hold it
quiver3(rand(10,1)*256,rand(10,1)*256,ones(10,1),rand(10,1)*15,rand(10,1)*15,rand(10,1)*7);
%Quiverize it
  1 commentaire
Ken
Ken le 23 Août 2011
Works great! Thanks a bunch!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Vector Fields 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