Met a good "OpenCV introductory tutorial" http://www.opencv.org.cn/forum.php?mod=viewthread&tid=33549
An introduction to the operations that contain the matrix classes and their memory management
And the operation of reading and writing images and videos.
An example
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace std;
using namespace CV;
int main () {
cascadeclassifier classifier;//classifier
classifier.load ("E:\\training\\result\\cascade.xml");// Load classifier
Mat img = imread ("E:\\training\\result\\1.jpg", 0);//The image to be detected, 0 to convert to grayscale figure
vector<rect> faces;// Save the rectangle of the identified target
//The last two parameters are the minimum size and maximum size of the scan window
Classifier.detectmultiscale (IMG, faces, 1.1, 2, 0 | Cv_haar_scale_image, Size (+));
if (Faces.empty ()) {
imshow ("Test", IMG);
Waitkey (0);
return 0;
}
else{
//mark the Recognized object//
Compute Center Point
Center (faces[0].x + FACES[0].WIDTH/2, faces[0].y + FACES[0].HEIGHT/2); c19/>//draws the ellipse
ellipse (IMG, center, Size (Faces[0].width, faces[0].height),
0, 255, 0, Scalar (0), 1, 1); c22/>//Display picture
imshow ("Test", IMG);
Waitkey (0);
return 0;
}
}
Detectmultiscale This method is very slow,,, scan again I use 50x50 only scan 1 times have to 1s time, basically not reach the application requirements, should consider the actual situation of the problem, self-rewriting the method of detection, such as more accurately limit the size of the scan window, narrow the scope of the scan, Do parallel scanning and so on optimization measures.