在Matlab中将向量场应用于图像 [英] Applying a vector field to image in matlab
问题描述
如何将通过颤动获得的矢量场应用于图像,使像素沿矢量方向移位(图像变形)?
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中将向量场应用于图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!