人脸pts文件检查及人脸框输出
function output() outtxt = fopen('D:\AR database\kz.txt','wt'); : imgpath= strcat('D:\AR database\kz\',int2str(i) , '.jpg'); img = im2uint8(imread(imgpath)); shapepath = strcat(imgpath(:end-), 'pts'); shape = double(loadshape(shapepath)); bbox = getbbox(shape); region = enlargingbbox(bbox, 1.25); out(outtxt, imgpath, region, shape); %drawshapes(img, shape); %rectangle(),bbox(),bbox(),bbox()]); %rectangle(),region(),region(),region()]); %i %w = waitforbuttonpress; end fclose(outtxt); end function out(outtxt, imgpath, region, shape) fprintf(outtxt, '%s ', imgpath); fprintf(outtxt, ),region(),region(),region()); fprintf(outtxt, , ); : shapes2(i, ) = shape(i, ) - region(); shapes2(i, ) = shape(i, ) - region(); fprintf(outtxt, ), shapes2(i, )); end fprintf(outtxt, '\n'); end function shape = loadshape(path) % function: load shape from pts file file = fopen(path); if ~isempty(strfind(path, 'COFW')) shape = textscan(file, , ); else shape = textscan(file, , ); end fclose(file); shape = shape{}; end function drawshapes(img, shapes) %DRAWSHAPE Summary of this function goes here % Function: draw face landmarks on img % Detailed explanation goes here % Input: % img: input image % shapes: given face shapes imshow(img); hold on; colors = {'r.' 'g.' 'b.' 'c.' 'm.' 'y.' 'k.'}; :size(shapes, )/ % :size(shapes, ) % scatter(shapes(*(s-) + ), shapes(*s),'w.'); scatter(shapes(*(s-) + ), shapes(*s),'k'); %text(shapes(*(s-) + ),shapes(*s),{is},'color','r'); end end end function bbox = getbbox(shape) %GETBBOX Summary of this function goes here % Function: get the bounding box of given shape % Detailed explanation goes here % Input: % shape: the shape of face % Output: % bbox: the bounding box of given face shape bbox = zeros(, ); left_x = min(shape(:, )); right_x = max(shape(:, )); top_y = min(shape(:, )); bottom_y = max(shape(:, )); bbox() = left_x; bbox() = top_y; bbox() = right_x - left_x + ; bbox() = bottom_y - top_y + ; end function region = enlargingbbox(bbox, scale) region() = floor(bbox() - (scale - )/*bbox()); region() = floor(bbox() - (scale - )/*bbox()); region() = floor(scale*bbox()); region() = floor(scale*bbox()); % region.right_x = floor(region.left_x + region.width - ); % region.bottom_y = floor(region.top_y + region.height - ); end
人脸pts文件检查及人脸框输出的更多相关文章
- 将Mat类型坐标数据生成pts文件
前言 获取人脸特征点的坐标信息之后,想要将坐标信息shape保存为pts/asf/txt等文件格式,本文就对此进行实现. 实现过程 1.确定pts文件的书写格式: 以要生成的文件为例,书写格式如下: ...
- 百度人脸识别api及face++人脸识别api测试(python)
一.百度人脸识别服务 1.官方网址:http://apistore.baidu.com/apiworks/servicedetail/464.html 2.提供的接口包括: 2.1 多人脸比对:请求多 ...
- ASP.NET MVC 4 (十一) Bundles和显示模式--asp.net mvc中 @Scripts.Render("~/bundles/jquery")是什么意思? 在布局文件中使用Scripts.Render()输出脚本包,Styles.Render()输出风格包:
ASP.NET MVC 4 (十一) Bundles和显示模式 ASP.NET MVC 4 引入的js打包压缩功能.打包压缩jquery目录下的文件,在布局文件中使用Scripts.Render()输 ...
- opencv实现人脸识别(二) 人脸图像采集模块
这一步我们开始搭建第一个模块,用来检测到图像中的人脸位置,并将它拍下来保存在指定路径 流程图: 代码实现: import cv2 def pic(cam): # 调用笔记本内置摄像头,所以参数为0,如 ...
- .gho文件检查
虽然目前windows10的接受程度越来越广泛,但我接触到的一些非IT人士还是钟爱于windows7系统,本文记录一下在使用ghost还原系统遇到的问题. gho还原失败 在还原ghost系统过程中, ...
- jQuery检查复选框是否被选
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- 转《trackingjs+websocket+百度人脸识别API,实现人脸签到》流程
先用websocket与后台建立通讯:用trackingjs在页面调用电脑摄像头,监听人脸,发现有人脸进入屏幕了,就把图片转成base64字符串,通过websocket发送到后端:后端拿到图片,调用百 ...
- python工具 - alert弹框输出姓名年龄、求和
使用python自带的tkinter库进行GUI编程,完成两个功能: (1)要求用户输入姓名和年龄然后打印出来 (2)要求用户输入一个数字,然后计算1到该数字之间的和 代码部分: # 导入tkinte ...
- python筛选特定文件的信息按照格式输出到txt
最近搞数据库,为了把图片文件的信息导入数据库表中,我开始研究python列出图片文件,其中发现因为IE临时文件里有非常多的不需要的图片,就需要筛选掉一些文件. 最终用python输出了所有需要的图片文 ...
随机推荐
- COJ559 回文
试题描述 给定字符串,求它的回文子序列个数.回文子序列反转字符顺序后仍然与原序列相同.例如字符串aba中,回文子序列为"a", "a", "aa&qu ...
- 连接mysql遇到的问题
1. 首先使用一个用户名不行时,可以新建一个用户名点击用户,输入名和密码,此时一定要记住密码,别忘了.不过也可以点击编辑用户改.此时连接时发现还是连接不上.出现错误信息为: Access denied ...
- 错误之thinkphp模型使用发生的错误
刚接触thinkphp模型的创建,在创建model类时在这里边声明了类的对象.唉,这是不理解的错误啊.什么叫做实例化模型对象,在控制器里边使用才创建. 模型这里写各种用到的函数. 这里我也体会到了查询 ...
- PHP有两个不同的版本:4.x系列版本和5.x系列版本
在为用户提供动态内容方面,PHP和MySQL是一个强大的组合.这些年来,这两项产品已经跨越了它们最初的应用舞台,现在,一些世界上最繁忙的网站也在应用它们.虽然它们当初都是开源软件,只能在UNIX/Li ...
- virt-XXX
尽管 virt-manager 是 libvirt 虚拟化 API 的一个首要用户,但有一个越来越庞大的工具生态系统在使用此接口进行虚拟化管理.virt-manager 包提供了一个便捷的 GUI,用 ...
- SPOJ 3267 D-query(离散化+主席树求区间内不同数的个数)
DQUERY - D-query #sorting #tree English Vietnamese Given a sequence of n numbers a1, a2, ..., an and ...
- Java学习资源
Java技术路线图 指路明灯 一位资深程序员大牛给予Java初学者的学习路线建议 Java源码阅读的真实体会 概要 JDK发展历程 Java项目经验 基于java平台的常用资源 官方文档 Java™ ...
- Mysql时间函数
http://blog.sina.com.cn/s/blog_6d39dc6f0100m7eo.html mysql中函数和关键字不区分大小写.下文函数的datetime参数处既可以用时间字符串也可以 ...
- uitextfield输入字符限制
-(UITextField*)createField:(NSString*)placeholder andTag:(int)tag andFont:(double)font{ UITextField ...
- VS 本机调试
VS~通过IIS网站启用"域名"调试 在我们开发网站时,对某些信息进行序列化时,通常使用session,cookies,nosql等技术,而为了安全,我们在服务器上很多情况都做了防 ...