资源简介
详细内容见博客:https://blog.csdn.net/li_wen01/article/details/78369751
代码片段和文件信息
#include “opencv2/objdetect.hpp“
#include “opencv2/highgui.hpp“
#include “opencv2/imgproc.hpp“
#include
using namespace std;
using namespace cv;
#define IMAGE_NAME “01.jpg“
void detectAndDraw( Mat& img CascadeClassifier& cascade
CascadeClassifier& nestedCascade
double scale bool tryflip );
string cascadeName;
int main( int argc const char** argv )
{
VideoCapture capture;
Mat frame image;
string inputName;
bool tryflip;
CascadeClassifier cascade nestedCascade;
double scale = 1.3;
if( !cascade.load(“./haarcascade_frontalface_alt2.xml“) )
{
cerr << “ERROR: Could not load classifier cascade“ << endl;
return -1;
}
image = imread(IMAGE_NAME 1 );
if( !image.empty() )
{
detectAndDraw( image cascade nestedCascade scale tryflip );
//waitKey(0);
}
return 0;
}
void detectAndDraw( Mat& img CascadeClassifier& cascade
CascadeClassifier& nestedCascade
double scale bool tryflip )
{
double t = 0;
vector faces faces2;
const static Scalar colors[] =
{
Scalar(25500)
Scalar(2551280)
Scalar(2552550)
Scalar(02550)
Scalar(0128255)
Scalar(0255255)
Scalar(00255)
Scalar(2550255)
};
Mat gray smallImg;
cvtColor( img gray COLOR_BGR2GRAY );
double fx = 1 / scale;
resize( gray smallImg Size() fx fx INTER_LINEAR );
equalizeHist( smallImg smallImg );
t = (double)getTickCount();
cascade.detectMultiScale( smallImg faces
1.1 2 0
//|CASCADE_FIND_BIGGEST_object
//|CASCADE_DO_ROUGH_SEARCH
|CASCADE_SCALE_IMAGE
Size(30 30) );
t = (double)getTickCount() - t;
printf( “detection time = %g ms\n“ t*1000/getTickFrequency());
for ( size_t i = 0; i < faces.size(); i++ )
{
Rect r = faces[i];
#if 0
printf(“face num = %d \n“(int)i);
cout << “矩形左上角的横坐标:“ << r.x << endl;
cout << “矩形左上角的纵坐标:“ << r.y << endl;
cout << “矩形的宽度:“ << r.width << endl;
cout << “矩形的高度:“ << r.height << endl;
cout << “矩形的尺寸:“ << r.size() << endl;
cout << “矩形的面积:“ << r.area() << endl;
cout << “矩形左上角的点坐标:“ << r.tl() << endl;
cout << “矩形右下角的点坐标:“ << r.br() << endl;
cout << endl << endl;
#endif
if(3600 < r.area())
{
Mat roi= img(Rect(r.x*(scale-0.1) r.y*(scale-0.1) r.width*(scale+0.2)r.height*(scale+0.3)));
Mat img1;
roi.copyTo(img1);
//namedWindow(“gag“1);
imwrite(“Roi.jpg“img1);
//imshow(“face“img1);
}
Scalar color = colors[i%8];
rectangle( img cvPoint(cvRound(r.x*(scale)) cvRound(r.y*(scale)))
cvPoint(cvRound((r.x + r.width-1)*scale) cvRound((r.y + r.height-1)*scale))
color 3 8 0);
}
//imshow( “result“ img );
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 237750 2018-11-25 12:27 OpenCV\arm_test\001.jpg
文件 3084 2018-10-19 09:48 OpenCV\arm_test\example.cpp
文件 601661 2018-10-19 08:51 OpenCV\arm_test\haarcascade_eye_tree_eyeglasses.xm
文件 540616 2017-10-17 19:00 OpenCV\arm_test\haarcascade_frontalface_alt2.xm
文件 3153 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cv.h
文件 2649 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cv.hpp
文件 2523 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cvaux.h
文件 2374 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cvaux.hpp
文件 2176 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cvwimage.h
文件 2424 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cxcore.h
文件 2443 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cxcore.hpp
文件 2257 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cxeigen.hpp
文件 129 2017-10-18 10:09 OpenCV\arm_test\include\opencv\cxmisc.h
文件 2226 2017-10-18 10:09 OpenCV\arm_test\include\opencv\highgui.h
文件 2145 2017-10-18 10:09 OpenCV\arm_test\include\opencv\ml.h
文件 2369 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\calib3d\calib3d.hpp
文件 20138 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\calib3d\calib3d_c.h
文件 122181 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\calib3d.hpp
文件 15392 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\affine.hpp
文件 26644 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\ba
文件 723 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\bufferpool.hpp
文件 2366 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\core.hpp
文件 131224 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\core_c.h
文件 8327 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\block.hpp
文件 24756 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\border_interpolate.hpp
文件 15518 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\color.hpp
文件 3814 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\common.hpp
文件 4720 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\datamov_utils.hpp
文件 222523 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\detail\color_detail.hpp
文件 15400 2017-10-18 10:09 OpenCV\arm_test\include\opencv2\core\cuda\detail\reduce.hpp
............此处省略248个文件信息
- 上一篇:NIKON D800 SDK 开发包 尼康
- 下一篇:工业防火墙白皮书
相关资源
- 基于Opencv3.0生成的dll
- arm版opencv-2.4.9
- opencv3 图片外接矩形框
- OPENCV 合成两张焦点不同,图像相同的
- OPENCV 找出图片焦点
- 《视觉系统设计》
- opencv1.0.0版本
- 相机标定完整工程
- VIBE算法原理及openCV源程序
- opencv+zbar实现摄像头二维码识别
- opencv学习---运动目标前景检测
- 新手学习opencv--基于Hog的视频行人检测
- 通过Kinect v2.0+ VS2012+openCV2.4.9将彩色帧
- Mastering OpenCV中文版
- vs2008下实现二维码扫描,图片扫描,
- 基于opencv2.4.9的车牌定位、倾斜校正、
- OpenCV张正友相机标定程序,附实验数
- HOG特征可视化C代码
- 基于vs2013+opencv实现的CT平扫式二维断
- 车牌识别完整版 基于OPENCV3 完全实现
- opencv实现多角度重建
- 车辆识别项目.rar
- 张正友相机标定Opencv实现完整程序+棋
- OpenCV计算机视觉编程攻略 (第2版)
- opencv视频行人检测1HOG+SVM
- OpenCV手势动作识别--石头剪刀布
- 图像匹配 目标轮廓匹配 基于OPENCV库
- opencv视觉导航小车寻迹
- 对图像的一维高斯滤波操作
- opencv420_boostdesc_bgm_vgg_generated.zip
评论
共有 条评论