imshow3D( I, varargin )

Version 2.0.0.0 (8,01 ko) par Mbvalentin
Display images in a certain custom 3D shape.
114 téléchargements
Mise à jour 30 sept. 2016

Afficher la licence

This function helps the user to display images in a certain custom 3D shape. It basically can be used as imshow(). When no shape is specified, the input image "I" will be plotted in a cylinder. The user can specify the shape in two different ways: 1) Specify the x,y,z coordinates or the shape or 2) Specify a radius line, which will be used to generate a revolution body.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% EXAMPLES: I = peaks(); figure, imshow3D(I,'shape','sphere','colmap',hot(256));
%
% 1) Specify a shape with x,y,z coordinates:
%
% % Plot a cone
% r = (1:1000)';
% I = imresize(peaks(),[1000 1000]);
% nres = size(I,2);
% x = repmat(r,[1 nres]).*repmat(sin(linspace(0,2*pi,nres)),[numel(r) 1]);
% y = repmat(r,[1 nres]).*repmat(cos(linspace(0,2*pi,nres)),[numel(r) 1]);
% z = repmat((1:numel(r))',[1 nres]);
% figure, imshow3D(I,'shape',{x y z},'colmap',winter(256))
%
% % Plot a parallepiped:
% I = imresize(peaks(),[100 100]);
% r = ones(size(I,1),1);
% nres = size(I,2);
% t_aux = repmat(r,[1 nres/4]).*repmat(linspace(-1,1,nres/4),[numel(r) 1]);
% x = [repmat(r,[1 nres/4]), t_aux(:,end:-1:1), repmat(-r,[1 nres/4]) t_aux];
% y = [t_aux, repmat(r,[1 nres/4]), t_aux(:,end:-1:1), repmat(-r,[1 nres/4])];
% z = repmat((1:numel(r))',[1 nres]);
% figure, imshow3D(I,'shape',{x y z},'colmap',winter(256))
%
% % Plot a zig-zag shape:
% I = imresize(peaks(),[100 100]);
% r = ones(size(I,1),1);
% nres = size(I,2);
% x = [repmat(r,[1 nres/2]) zeros(numel(r),nres/2)];
% y = [repmat(r,[1 nres/4]) zeros(numel(r),nres/4) repmat(r,[1 nres/4]) zeros(numel(r),nres/4)];
% z = repmat((1:numel(r))',[1 nres]);
% figure, imshow3D(I,'shape',{x y z},'colmap',winter(256))
%
% % Plot a spiral
% nres = 100;
% I = imresize(peaks(),[nres nres]);
% r = repmat(linspace(1,10,nres),[size(I,1) 1]);
% x = repmat(sin(linspace(0,2*pi,nres)),[size(r,1) 1]).*r;
% y = repmat(cos(linspace(0,2*pi,nres)),[size(r,1) 1]).*r;
% z = repmat((1:size(r,1))',[1 nres]);
% figure, imshow3D(I,'shape',{x y z},'colmap',hot(256))
%
% % Plot a heart
% nres = 100;
% I = imresize(peaks(),[nres nres]);
% r = repmat([linspace(1,10,nres/2), linspace(10,1,nres/2)],[size(I,1) 1]);
% x = repmat(sin(linspace(0,2*pi,nres)),[size(r,1) 1]).*r;
% y = repmat(cos(linspace(0,2*pi,nres)),[size(r,1) 1]).*r;
% z = repmat((1:size(r,1))',[1 nres]);
% figure, imshow3D(I,'shape',{x y z},'colmap',hot(256))
%
% % Plot a flower
% npetals = 6; % Number of petals
% nres = 100;
% I = imresize(peaks(),[nres nres]);
% r = repmat(2 - sin(linspace(0,2*npetals*pi,nres)), [size(I,1) 1]);
% x = repmat(sin(linspace(0,2*pi,nres)),[size(r,1) 1]).*r;
% y = repmat(cos(linspace(0,2*pi,nres)),[size(r,1) 1]).*r;
% z = repmat((1:size(r,1))',[1 nres]);
% figure, imshow3D(I,'shape',{x y z},'colmap',winter(256))
%
%
% 2) Specify a shape only with a single line:
%
% % Plot a cone
% r = (1:1000)';
% figure, imshow3D(I,'shape',r,'colmap',winter(256))
%
% % Plot a Gaussian with mu=0 and sigma=2 using normpdf
% I = imresize(peaks(),[1000 1000]);
% r = normpdf(linspace(-10,10,size(I,1)),0,2)';
% figure, imshow3D(I,'shape',r,'colmap',winter(256))
%
% % Plot a Chi-Square distribution using pdf:
% I = imresize(peaks(),[1000 1000]);
% r = pdf('Chisquare',linspace(0,20,size(I,1)),4);
% figure, imshow3D(I,'shape',r,'colmap',winter(256))
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Manuel Blanco Valentin
% Industrial Engineer & Project Analyst
% e-mail: mbvalentin@cbpf.br
%
% Centro Brasileiro de Pesquisas (CBPF) - CENPES - PETROBRAS
% Rio de Janeiro - Brazil - 2015
%
% LICENSE: This code is open-source, feel free to use it under your own
% responsability. Feel free to share this code, but please, do not delete
% this comments.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Citation pour cette source

Mbvalentin (2025). imshow3D( I, varargin ) (https://fr.mathworks.com/matlabcentral/fileexchange/59364-imshow3d-i-varargin), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2014a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Display Image dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
2.0.0.0