SDM For Face Alignment流程介绍及Matlab代码实现之测试篇

测试很简单了,只需要载入数据,然后做正则化处理,使用训练模型产生的{Rk},就可以预测特征点了。
face_alignment.m:用来预测特征点

function shape = face_alignment( ShapeModel, DataVariation,...LearnedCascadedModel, Data, img, shape, options )%% setup the fixed parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nData = length(Data);
shapeDim = size(ShapeModel.MeanShape,1);
n_init_randoms_test = options.n_init_randoms_test;MeanShape2 = vec_2_shape(ShapeModel.MeanShape);aligned_shape = zeros(n_init_randoms_test,shapeDim);%% detect the face region using face detectors or ground-truth %%%%%%%%%%%%
%% if using ground-truthboxes = detect_face( img , options );
%% predict the face boxbbox2 = get_correct_region2( boxes, shape,img, 1 );
bbox= [];if isempty(bbox)%% if using ground-truthbbox = getbbox(shape);
end%% randomize n positions for initial shapes
[rbbox] = random_init_position( ...bbox, DataVariation, n_init_randoms_test );
[rbbox2] = random_init_position( ...bbox2, DataVariation, n_init_randoms_test );
%% randomize which shape is used for initial position
rIdx = randi([1,nData],n_init_randoms_test);%% iterations of n initial points %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for ir = 1 : n_init_randoms_test%% get random positions and inital shape indexsidx    = rIdx(ir);init_shape = Data(idx).shape; %% get randomly shape from otherscbbox  = rbbox(ir,:);cbbox2  = rbbox2(ir,:);%init_shape = resetshape(cbbox, init_shape);init_shape = resetshape(cbbox, MeanShape2);init_shape2 = resetshape(cbbox2, MeanShape2);%test box between  ground-truth and face detectorif 0figure(1); imshow(img); hold on;draw_shape(init_shape(:,1), init_shape(:,2),'r');draw_shape(init_shape2(:,1), init_shape2(:,2),'g');hold on;rectangle('Position',  cbbox, 'EdgeColor', 'y');rectangle('Position',  cbbox2, 'EdgeColor', 'k');hold off;pause;end%% detect landmarks using cascaded regressionaligned_shape(ir,:) = cascaded_regress( ShapeModel, ...LearnedCascadedModel, img, init_shape, options );end
if n_init_randoms_test == 1shape = vec_2_shape(aligned_shape');
elseshape = vec_2_shape(mean(aligned_shape)');
endend

我们来看一下效果:


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/259254.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Flink – JobManager.submitJob

JobManager作为actor, case SubmitJob(jobGraph, listeningBehaviour) >val client sender()val jobInfo new JobInfo(client, listeningBehaviour, System.currentTimeMillis(),jobGraph.getSessionTimeout)submitJob(jobGraph, jobInfo) submitJob&#xff0…

window内容

window parent top location.href location.reload location.replace转载于:https://www.cnblogs.com/carlos-guo/p/3391784.html

计算机类公务员如何提升自己,大学毕业才发现:所学专业对考公务员如此重要,4类专业上岸率高...

导语:毕业季来临,同学们是想直接找工作积累工作经验,还是继续考取相关证书,来获得更稳定职业的入场券?毕业抉择很多毕业生面临的第一个问题就是未来职业规划,因为大学毕业之后,就意味着一段新的…

使用getline读入

直接上代码&#xff1a; 第一份&#xff1a;从cin 读入多行数字&#xff0c;每行2个。当输入完毕后&#xff0c;按2次回车结束 #include<iostream> #include <cstdio> #include <sstream> #include <string> #include <vector> #include <it…

POJ 1221

整数划分 划分成单峰的回文数列 dp[i][j] 表示 把i划分&#xff0c;其中划分的数不能大于j 1             i1或j1 dp[i][j]  dp[i][j-1]1         ji dp(i,j-1)dp(i-j,min(i-j,j)) i>j>1 1 #include <iostream>2 #include <cstd…

HYSBZ - 1050(旅行comf 并查集Java实现)

HYSBZ - 1050(旅行comf Java实现) 原题地址 解法&#xff1a;枚举每一条边&#xff0c;对于这条边&#xff0c;我们需要找到集合中和其值相差最小的最大边&#xff0c;这个集合是指与包括i边在内的ST联通集。对于这一要求&#xff0c;我们只需对所有的边进行从小到大的排序&…

UVA 11401 - Triangle Counting

Problem G Triangle Counting Input: Standard Input Output: Standard Output You are given n rods of length 1, 2…, n. You have to pick any 3 of them & build a triangle. How many distinct triangles can you make? Note that, two triangles will be considere…

苏州软件测试11k工资要什么水平,3个月从机械转行软件测试,他的入职薪资是11K...

原标题&#xff1a;3个月从机械转行软件测试&#xff0c;他的入职薪资是11K只要找到适合自己的学习方式&#xff0c;成功转行只是早晚的问题&#xff01;今天汇智妹给大家介绍的这位小伙伴&#xff0c;是咱们汇学联盟平台上的一位线上学员——小周。97年的小哥哥&#xff0c;19…

python idle 清屏问题的解决

在学习和使用python的过程中&#xff0c;少不了要与python idle打交道。但使用python idle都会遇到一个常见而又懊恼的问题——要怎么清屏?我在stackoverflow看到这样两种答案&#xff1a;1.在shell中输入1 import os 2 os.system(cls) 这种方法只能在windows系统中cmd模式下的…

TCP/IP 原理--链路层

链路层作用&#xff1a; &#xff08;1&#xff09;为IP模块发送和接收IP数据报&#xff1b; &#xff08;2&#xff09;为ARP发送ARP请求和接受ARP应答 &#xff08;3&#xff09;为RARP发送RARP请求和接受ARP应答 协议&#xff1a;以太网和SLIP协议 A.以太网协议数据封装格式…

Sqoop拒绝连接错误

使用Sqoop远程连接MySQL导入数据到HBase数据库&#xff1a; sqoop import --driver com.mysql.jdbc.Driver --connect "jdbc:mysql://hzhiServer:3306/myssh?autoReconnecttrue" --table table_001 --username hadoop --password 1 --hbase-table table_001 --colum…

拆解凹多边形

偶遇需要拆解凹多边形 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media;namespace DrawPolygon {public static class Settings{public const float…

计算机教学的弊端,信息技术在教学中的利弊及解决对策

摘 要&#xff1a;信息技术教育已成为国家信息化事业的重要组成部分&#xff0c;是当今素质教育的重要内容之一。从阐述信息技术教育的内涵和发展阶段出发&#xff0c;分析了当前信息技术在教学应用中的优势和存在的问题&#xff0c;并提出了相应的解决对策。关键词&#xff1a…

【转】Linux命令之查看文件占用空间大小-du,df

原文网址&#xff1a;http://blog.csdn.net/wangjunjun2008/article/details/19840671 du(disk usage),顾名思义,查看目录/文件占用空间大小#查看当前目录下的所有目录以及子目录的大小$ du -h $ du -ah #-h:用K、M、G的人性化形式显示 #-a:显示目录和文件 du -h tmp du -ah tm…

一个FORK的面试题

为什么80%的码农都做不了架构师&#xff1f;>>> #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { int i; for(i0; i<2; i){ fork(); printf("-"); } wait(NULL); wait(NULL); return 0; }/c 如果…

C++11系列学习之二-----lambda表达式

C11添加了一项名为lambda表达式的新功能&#xff0c;通过这项功能可以编写内嵌的匿名函数&#xff0c;而不必编写独立函数和函数对象&#xff0c;使得代码更容易理解。lambda表达式的语法如下所示&#xff1a;[capture_block](parameters) exceptions_specification -> retu…

php四种基础算法:冒泡,选择,插入和快速排序法

许多人都说 算法是程序的核心&#xff0c;一个程序的好于差,关键是这个程序算法的优劣。作为一个初级phper&#xff0c;虽然很少接触到算法方面的东西 。但是对于冒泡排序&#xff0c;插入排序&#xff0c;选择排序&#xff0c;快速排序四种基本算法&#xff0c;我想还是要掌握…

GCPC2014 C Bounty Hunter

题意&#xff1a;给你一个平面上的点集&#xff08;x值各不相等&#xff09;&#xff0c;问你从最左边走到最右边&#xff08;只能以x递增的顺序&#xff09;&#xff0c;再从最右边回到最左边&#xff08;以x递减的顺序&#xff09;问你最短距离是多少。 解题思路&#xff1a;…

计算机启动时运行ccleaner,Ccleaner的使用方法

ccleaner是一款非常好用的系统优化工具&#xff0c;它可以提升电脑速度&#xff0c;可以对上网历史记录、临时文件夹、回收站垃圾清理、注册表进行垃圾项扫描和清理、软件卸载等功能&#xff0c;保护用户的个人浏览隐私&#xff0c;为Windows系统腾出更多硬盘空间。下面小编就为…

PLSQL Developer软件使用大全

PLSQL Developer软件使用大全 第一章 PLSQL Developer特性 PL/SQL Developer是一个集成开发环境&#xff0c;专门面向Oracle数据库存储程序单元的开发。如今&#xff0c;有越来越多的商业逻辑和应用逻辑转向了Oracle Server&#xff0c;因此&#xff0c;PL/SQL编程也成了整个开…