Filter löschen
Filter löschen

3d plot of an image

11 Ansichten (letzte 30 Tage)
Mahua Nandy(Pal)
Mahua Nandy(Pal) am 19 Sep. 2012
how can i get 3d plot of an image

Antworten (4)

Image Analyst
Image Analyst am 24 Sep. 2012

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

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 24 Sep. 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 Kommentar
Mahua Nandy(Pal)
Mahua Nandy(Pal) am 25 Sep. 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.

Melden Sie sich an, um zu kommentieren.


Sean de Wolski
Sean de Wolski am 24 Sep. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by