描述:
检测出来的人脸按人数分类加矩形实线框、保存在新目录下。
#include <time.h>
#include<string.h> 
#include<sstream> 
#include <iostream> 
#include <iomanip>   
#include <fstream>   
#include<direct.h>    //头文件   
#include<opencv2/opencv.hpp>   
#include<opencv2/highgui/highgui.hpp>   
#include<opencv2/imgproc/imgproc.hpp>   
#include "FaceDetection.h" 
/*整型转为字符串型*/ 
string num2str(int i); 
/*双浮点点型转为字符串型*/ 
string num2str(double i); 
/*检测单张人脸图像*/ 
void getface(string filename, string savepath); 
/*调用检测人脸程序*/ 
void get_face_detected(); 
/*总的人脸数*/ 
int face_number = 0; 
vector<ObjectStruct>vframe; 
/*输出结果文件*/ 
ofstream out("F:\\save_detected_face\\result.txt"); 
/*绘制矩形*/ 
void find_all_point(Point start, Point end, vector<Point> &save); 
void full_rotated_rect(Mat &image, const RotatedRect &rect, const Scalar &color); 
 int  main() 
{ 
 // Mat img_masked; 
// image.copyTo(img_masked, mask); 
 
 get_face_detected(); 
 getchar(); 
 return 0; 
} 
/*创建文件夹*/ 
/*调用检测人脸程序*/ 
void get_face_detected(){ 
 /*frameImg 读入图像变量 frameImg1读入图像副本变量*/ 
 std::vector<cv::String> filenames; // notice here that we are using the Opencv's embedded "String" class 
 // cv::String folder = "F:\\qq_friend_down_pic\\test\\*.jpg"; // again we are using the Opencv's embedded "String" class 
 cv::String folder = "F:\\qq_friend_down_pic\\test\\*.jpg"; 
 cv::glob(folder, filenames); // new function that does the job ;-); 
 for (size_t i = 0; i < filenames.size(); ++i){ 
 </

 雾霾的梦想  于 2018-06-04 10:38:38 发布
