Borrar filtros
Borrar filtros

3d plot of an image

14 visualizaciones (últimos 30 días)
Mahua Nandy(Pal)
Mahua Nandy(Pal) el 19 de Sept. de 2012
how can i get 3d plot of an image

Respuestas (4)

Image Analyst
Image Analyst el 24 de Sept. de 2012

Image Analyst
Image Analyst el 19 de Sept. de 2012
Perhaps you mean surf() or waterfall(), or you could mean scatter3(). Did you look up the 3D visualization section in the help?
  1 comentario
Mahua Nandy(Pal)
Mahua Nandy(Pal) el 24 de Sept. de 2012
please give me 3-4 line example piece of code how to see 3d visualization of an image using surf()

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 24 de Sept. de 2012
surf(double(yourImage));
More complete demo:
clc;
clearvars;
close all;
imtool close all; % Close all imtool figures.
workspace;
format longg;
format compact;
fontSize = 16;
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'cameraman.tif';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows columns numberOfColorBands] = size(grayImage);
% Display the original gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Give a name to the title bar.
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
subplot(2,2,2);
surf(double(grayImage));
  1 comentario
Mahua Nandy(Pal)
Mahua Nandy(Pal) el 25 de Sept. de 2012
Warning: Matrix dimensions must agree, not rendering mesh Warning: Matrix dimensions must agree, not rendering mesh Warning: Matrix dimensions must agree, not rendering mesh Warning: Matrix dimensions must agree, not rendering mesh
why these are coming with a .jpg gray image? with cameraman.tif it is ok.

Iniciar sesión para comentar.


Sean de Wolski
Sean de Wolski el 24 de Sept. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by