Plot the image intensities in 3D plot.

2 views (last 30 days)
Lizan
Lizan on 17 Oct 2012
Commented: Osman on 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?

Answers (1)

Image Analyst
Image Analyst on 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 Comments
Image Analyst
Image Analyst on 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 on 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)

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!