问题描述
如何将通过 quiver 获得的矢量场应用于导致像素在矢量方向上位移的图像(图像扭曲)?
How do I apply a vector field obtained via quiver, to an image which causes the pixels to displace in the direction of the vectors (image is warped)?
此外,如果我拥有的矢量场是 3 维的,我该怎么做?可以将其视为在 3 维地形上放置平坦的 2 维图像.我将如何在 matlab 中查看此内容?
Also, if the vector field I have is 3 dimensional, how would I do this? Think of it as laying down a flat 2 dimensional image over a 3 dimensional terrain. How would I go about viewing this in matlab?
感谢您的时间
我不仅要在 Z 轴上扭曲图像,还要在 X 和 Y 轴上扭曲图像.
I have to warp the image not just in the Z axis, but along the X and Y axes as well.
推荐答案
在 3 维地形上放置平面 2 维图像:
Laying down a flat 2 dimensional image over a 3 dimensional terrain:
轴的方向不是很清楚,但这是映射到峰函数上的小丑图像.surface
a> 在示例沿曲面图显示图像"中.
It's not very clear the way the axes are oriented but this is an image of a clown mapped on the peaks function. Exact steps are described in the documentation of surface
in the example 'Display image along surface plot.'
load clown
C = flipud(X);
figure
surface(XD,YD,ZD,C,...
'FaceColor','texturemap',...
'EdgeColor','none',...
'CDataMapping','direct')
colormap(map)
view(-35,45)
本质上,您使用 CData
作为要显示的图像创建表面,并为轴设置适当的颜色图.
Essentially, you create your surface with CData
as the image you want to be displayed and set an appropriate colormap for the axes.
这篇关于在matlab中将矢量场应用于图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!