필터 지우기
필터 지우기

3d plot of an image

조회 수: 11 (최근 30일)
Mahua Nandy(Pal)
Mahua Nandy(Pal) 2012년 9월 19일
how can i get 3d plot of an image

답변 (4개)

Image Analyst
Image Analyst 2012년 9월 24일

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

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2012년 9월 24일
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
Mahua Nandy(Pal)
Mahua Nandy(Pal) 2012년 9월 25일
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.

댓글을 달려면 로그인하십시오.


Sean de Wolski
Sean de Wolski 2012년 9월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by