人脸检测截图

一.描述

检测出人脸,获取人脸的开始的横纵坐标、长宽,作为rect保存到新的文件中。

部分代码:

/*计算总人脸数*/
face_number = vframe.size() + face_number;
for (int i = 0; i<vframe.size(); i++){
if (vframe[i].pos[4]>0.9){


for (int j = 0; j < 5; j++){
circle(frameImg1, Point(vframe[i].fps[j * 2 + 1], vframe[i].fps[j * 2 + 0]), 3, Scalar(0, 255, 255), -1);
rectangle(frameImg1, Point(vframe[i].pos[0], vframe[i].pos[1]), Point(vframe[i].pos[0] + vframe[i].pos[2], vframe[i].pos[1] + vframe[i].pos[3]), Scalar(0, 0, 255), 2, 8, 0); 

}
Mat imageROI;
//方法一
imageROI = frameImg1(Rect(vframe[i].pos[0], vframe[i].pos[1], vframe[i].pos[2], vframe[i].pos[3]));
/*保存图像地址*/
string file_path = "F:\\qq_friend_down_pic\\test1\\" + savepath + "_" + to_string(i) + ".jpg";


cout << "savepath =  " << file_path << "\n";
imwrite(file_path, imageROI);
cv::putText(frameImg1, num2str(vframe[i].pos[4]), Point(vframe[i].pos[0], vframe[i].pos[1]), CV_FONT_HERSHEY_SIMPLEX, 0.5, Scalar(255, 100, 0), 2, 2);
}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值