matlab内置函数fitgeotrans与transformPointsForward解析
来源:互联网 发布:艾磊软件 编辑:程序博客网 时间:2024/06/03 22:06
最近研究3000fps的实现,看了网上给的一个matlab代码,里面有提到init_shape到mean_shape的对齐,里面使用了fitgeotrans和transformPointsForward两个函数。于是参考matlab help研究了一下这两个函数.
fitgeotrans函数
语法:
tform = fitgeotrans(movingPoints,fixedPoints,transformationType)
说明:
- movingPoints — 图像上想要移动的点的坐标,至少是两个double型2维点.
- fixedPoints — 目标点,和上面同等规模
- transformationType — 变换类型,包括如下几种:
总结:
这个函数主要描述了将movingPoints(设大小为:N*2,N>=2)通过某种变换变化到fixedPoints来,最后输出了变换矩阵。tform 是一个结构体类型,里面包含了变换矩阵.
transformPointsForward函数
语法:
[x,y] = transformPointsForward(tform,u,v)X = transformPointsForward(tform,U)
说明:
tform为变换矩阵. u,v分别代表你要变换的点的x,y序列。u,v必须维数相同.变换后输出了对应的x,y。
而第二个函数,U包含了[u,v],X=[x,y]。
注意:
什么是前置变换呢?
即: X=U*tform
两个例子
例1
theta = 10;tform = affine2d([cosd(theta) -sind(theta) 0; sind(theta) cosd(theta) 0; 0 0 1])[X,Y] = transformPointsForward(tform,5,10)
结果:
tform =
affine2d with properties:
T: [3x3 double]Dimensionality: 2
其中
而X=6.6605 , Y=8.9798 。
具体计算方法是:
例2
I = checkerboard; %创建棋盘图J = imrotate(I,30); %逆时针绕中心旋转30度imshowpair(I,J,'montage') %将两图并排放在一起
fixedPoints = [11 11; 41 71];movingPoints = [14 44; 70 81];
tform = fitgeotrans(movingPoints,fixedPoints,'NonreflectiveSimilarity');
Jregistered = imwarp(J,tform,'OutputView',imref2d(size(I))); %应用变换,将图像旋转falsecolorOverlay = imfuse(I,Jregistered); %图形融合figure, imshow(falsecolorOverlay,'InitialMagnification','fit');
参考文献
基于空间几何变换的人脸对齐(Matlab内置函数)
0 0
- matlab内置函数fitgeotrans与transformPointsForward解析
- fitgeotrans,transformPointsForward,imwarp,非反射相似变换,相似变换,仿射变换
- matlab:常用内置函数
- MATLAB内置常见函数
- SQLServer常用内置函数解析
- Python3内置函数实例解析
- 函数与内置对象
- matlab cov 函数解析
- Matlab bsxfun函数解析
- Matlab函数解析
- Matlab entropyfilt函数 解析
- Matlab geoidheight 函数解析
- MATLAB filter函数解析
- Matlab内置的矩阵反转函数
- hive内置操作符与内置函数
- hive内置操作符与内置函数
- 【matlab】:matlab的linspace函数解析
- Python内置数据类型与函数
- 一文看懂IC芯片生产流程:从设计到制造与封装
- 电脑双网卡同时上内外网亲自实践教程
- C/CPP点滴积累—数组数据类型
- PHP spl_autoload和class_exsits使用技能
- UIDatePicker(loading...)
- matlab内置函数fitgeotrans与transformPointsForward解析
- c++语言段错误
- 公众平台测试帐号开发全流程第1篇-引言
- vbs 合并 excel 表格
- POJ 3349 Snowflake Snow Snowflakes
- TOEFL(20160123)分析
- R语言学习笔记之统计分析篇
- 机器学习(十三)k-svd字典学习
- CF 615 B Longtail Hedgehog(dfs/dp)