In 3D plot, how is the image displayed on a specific 3D spatial plane?

43 views (last 30 days)
I am trying to display my image on a certain plane in 3D plot space, for example by displaying one of matlab's own images "peppers.png" to a fixed position, during which I try to display the image using image or imshow build in function+view(3), but the default image position is (0, 0,0), By looking at the image function properties documentation, I only see the x,y position setting property, but not the z axis,I can't change its Z position, what should I do?
your answer would be like greatly apperaciate!
srcImg = imread("peppers.png");
figure;hold on;view(3)
% hAxis = gca;
% hAxis.XRuler.FirstCrossoverValue = 0; % X crossover with Y axis
% hAxis.XRuler.SecondCrossoverValue = 0; % X crossover with Z axis
% hAxis.YRuler.FirstCrossoverValue = 0; % Y crossover with X axis
% hAxis.YRuler.SecondCrossoverValue = 0; % Y crossover with Z axis
% hAxis.ZRuler.FirstCrossoverValue = 0; % Z crossover with X axis
% hAxis.ZRuler.SecondCrossoverValue = 0; % Z crossover with Y axis
image(srcImg);

Accepted Answer

Chunru
Chunru on 26 Aug 2022
srcImg = imread("peppers.png");
sz = size(srcImg);
[xx, yy] =meshgrid(1:sz(1), 1:sz(2));
zz = ones(size(xx)); % set the z value
figure;hold on;view(3)
warp(xx, yy, zz, srcImg)
%image(srcImg);

More Answers (1)

KSSV
KSSV on 26 Aug 2022

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!