Azzera filtri
Azzera filtri

3d plot of an image

11 visualizzazioni (ultimi 30 giorni)
Mahua Nandy(Pal)
Mahua Nandy(Pal) il 19 Set 2012
how can i get 3d plot of an image

Risposte (4)

Image Analyst
Image Analyst il 24 Set 2012

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

Accedi per commentare.


Image Analyst
Image Analyst il 24 Set 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 Commento
Mahua Nandy(Pal)
Mahua Nandy(Pal) il 25 Set 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.

Accedi per commentare.


Sean de Wolski
Sean de Wolski il 24 Set 2012

Community Treasure Hunt

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

Start Hunting!

Translated by