How to get displacement field or control point vector when we have tfrom?

爱⌒轻易说出口 提交于 2019-12-06 10:38:15

You can apply your geometric transform to a single point very easily.

You just need to have your point defined as p=[x;y;z;1]

and then obtain pt by pt=p*tform; pt=pt(1:3)./pt(4); (search for homogeneous coordinates for explanation of this last division). This is what imwarp does in the inside. It performs the said multiplication for each pixel p.

To then obtain the displacement, you would need just to disp=pt-p;. Note that the displacements are most likely not integer.

Note that in the field of deformable image registration, generally you will have a different tform for each control point (that is why it is called deformable and not rigid)

EDIT: as @Ashish Uthama suggests in the comments, you can also do it with Matlab inbuilt function transformpointsforward(). I will always be a promoter of "writing your own code" philosophy, specially the first time, so you do understand what are you actually doing.

http://uk.mathworks.com/help/images/ref/affine3d.transformpointsforward.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!