Plot the image intensities in 3D plot.

2 vues (au cours des 30 derniers jours)
Lizan
Lizan le 17 Oct 2012
Commenté : Osman le 10 Nov 2014
Hi,
I have stored images in an array, example of the first image is
myPict{1,1}{1,1}
and the second,
myPict{1,1}{1,2} or myPict{2,1}{1,1}
Not important, anyways,..
I would like to plot the pixel intensity in a 3D plot. How can I do this?
I tried with,
y = 1:480; x = 1:640; [x,y] = meshgrid(x,y); surface(x,y,myPict{1,1}{1,1}(:,:,1))
but I only get an empty figure.
Anyone know what the problem is?

Réponses (1)

Image Analyst
Image Analyst le 17 Oct 2012
Try this:
rgbImage = myPict{1,1}{1,1}(:,:,1);
[rows columns numberOfColorChannels] = size(rgbImage)
figure;
imshow(rgbImage);
what does it say in the command window for the size of the image? Does it show any 2D color image in the axes of the new figure?
  3 commentaires
Image Analyst
Image Analyst le 17 Oct 2012
OK - it's actually a monochrome (grayscale) image. What does this say
class(rgbImage)
If it says single or double, do this
imshow(rgbImage, []);
See if that will show something.
Osman
Osman le 10 Nov 2014
% Convert your image to double scale then plot using surf or mesh.. I = imread('your image'); J = double(I); % if the image is RGB convert to gray scale. % Displaying x1 = 640; % Number of row y1 = 480; % Number of column [x,y] = meshgrid(1:y1,1:x1); figure, Surf(x,y,J)

Connectez-vous pour commenter.

Catégories

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