//------------------------------------- Head test -------------------------------------
int main()
{     //VideoCapture video("E:\\C_VC_code\\Text_Photo\\feini.flv");
    FILE *read = fopen("detector_TQ.txt", "r");
    if (read == NULL)
        cout << "Error: The file read fail" << endl;
        return -1;
    double data;
    while (fscanf(read, "%lf", &data) != -1)
    cout << head.size() << endl;     VideoCapture video(0);
    if (!video.isOpened())
        return 0;
    Mat img, dstimg;
    Rect r;
    HOGDescriptor hog(Size(48, 48), Size(16, 16), Size(8, 8), Size(8, 8), 9);
    double scalar = 0.5;
    int i, j;
    while (1)
        video >> img;
        resize(img, dstimg, Size(img.cols*scalar, img.rows*scalar), 1, 1, 3);
        hog.detectMultiScale(dstimg, found, 1, cv::Size(8, 8), cv::Size(0, 0), 1.1, 3, false);
        // Remove nested rectangles
        for (i = 0; i < found.size(); i++)
            r = found[i];             for (j = 0; j < found.size(); j++)
                if (i != j && (r&found[j]) == r)
            if (j == found.size())
        //draw rect
        for (i = 0; i<result.size(); i++)
            r = result[i];
            r.x = r.x/scalar*0.81;
            r.y = r.y/scalar;
            r.width = r.width/scalar*1.7;
            r.height = r.height/scalar*4;
            rectangle(img, r, CV_RGB(0, 255, 0), 2);
        //imshow("video1", dstimg);
        imshow("video", img);
        if (waitKey(33) == 27)
            imshow("video", img);

Opencv More articles on head tracking detection

  1. OpenCV Feature point detection ------ORB features

    OpenCV Feature point detection ------ORB features ORB Yes ORiented Brief For short .ORB In the following article : Ethan Rublee and Vincent Rabaud and Kurt ...

  2. opencv Lane line detection

    opencv Lane line detection Finished function Image cropping : By setting the image ROI Area , Copy images to get cropped images Anti perspective transformation : Using the video from the teacher , There is no corresponding transformation matrix . So establish two-dimensional coordinates , The matrix is calculated by four point mapping , Do a reverse perspective ...

  3. 【 Reprint 】opencv Face detection

    The full text is reproduced from CSDN The blog of ( I don't know how to CSDN My blog goes to blog Garden , It should not have this function , So copy the full text directly ), The reprint address is as follows http://blog.csdn.net/lsq2902101015/article ...

  4. [PyImageSearch] Ubuntu16.04 Use deep learning and OpenCV Realize object detection

    The last blog post talked about how to use OpenCV Realize object classification , But the next blog post will tell you where the object in the picture is . We will know how to use OpenCV‘s Of dnn Module to load a pre trained object detection network , It enables us to ...

  5. 【python+opencv】 Straight line detection + Circle detection

     Python+OpenCV The image processing —— Straight line detection Theoretical knowledge of line detection : 1. Hough transform (Hough Transform) Hough transform is one of the basic methods to recognize geometric shape from image in image processing , It's widely used , There are also many improvements ...

  6. OpenCV Learning Series ( One ) Mac Next OpenCV + xcode Face detection implementation

    # OpenCV Learning Series ( One ) Mac Next OpenCV + xcode Face detection implementation [-= Blog directory =-] 1- Learning goals 1.1- This chapter is an introduction. 1.2- Practice content 1.3- Related instructions 2- The learning process 2.1- Ring ...

  7. be based on OpenCV The flame detection of ( Two )——RGB Color criteria

    I share with you the image preprocessing methods commonly used in flame detection , Start with this blog post , I'll show you how to detect the flame area step by step . Flame extraction uses To a lot of criteria , What I want to introduce to you today is the simplest but most effective criterion --RGB sentence ...

  8. be based on OpenCV The flame detection of ( One )—— Image preprocessing

    Bloggers are currently doing a project based on OpenCV The flame detection project of , Not only can it detect the flame in the picture , You can also detect flames in the video , Finally, on the basis of video detection, it is extended to camera real-time detection . While doing this project , Bloggers refer to a lot of relevant literature , There are many kinds of ...

  9. OpenCV—Python Contour detection Draw a rectangle (findContours\ boundingRect\rectangle

    Pay attention to opencv Contour detection and edge detection are two different things Link to this article :https://blog.csdn.net/wsp_1138886114/article/details/82945328 1 Get profile O ...

Random recommendation

  1. Use HttpClient send out get、post request , And its analysis xml Return the data

    One . About HttpClient Use : You can refer to this blog address , Here is a detailed introduction , You can have a look at what you need first : The address is :http://blog.csdn.net/wangpeng047/article/detai ...

  2. PS Web design tutorial ——30 A good PS Web design course of Chinese translation course

    PS Web design tutorial --30 A good PS Web design course of Chinese translation course   As a coder , Art foundation is weak . We can refer to some mature web pages PS course , Improve your design ability . To paraphrase ," Familiar with 300 tang poems , I can't do ...

  3. iOS How to load the program view

    The UIViewController class provides built-in support for loading a view controller's views whenever ...

  4. WRONGTYPE Operation against a key holding the wrong kind of value

    Change the code today , It's wrong when it's running , The reason for the error : because redis The same... Already exists in key, and key The corresponding value type is not Set, It is SortSet( Before modification ): Call again smembers when , Throw this error . resolvent : ...

  5. hold Message convert to String

    hold Message convert to String Be careful , There is a lack of CM News and CN news , Because they're not system messages , Not pass Dispatch API forward , But you can write them in WndProc in , such SendMessage The message is also ...

  6. send --no-ri --no-rdoc Become gem Default options for installation

    In the use of gem install When ordered , Hope to add --no-ri --no-rdoc Options , But I don't want to add this option manually every time . You can actually edit the configuration file , change gem install Default options . stay win ...

  7. HDU1379:DNA Sorting

    Problem Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries ...

  8. thinkPHP Built in string interception msubstr Function usage detailed explanation

    author : Chen Dahui typeface :[ increase Reduce ] type : Reprint Time :2016-11-15 I want to comment on This article mainly introduces thinkPHP Built in string interception function usage , Combined with the example form, the paper analyzes thinkPHP Built in string interception function ...

  9. Use Docker link build PHP development environment

    Generally, we will put nginx.php All in the same container , For the convenience of expansion , We hope nginx and php Separate . Then you can use it docker link Command to achieve this purpose . Image required : nginx 1.12.2 php( ...

  10. 201421123042 《Java Programming 》 The first 6 Weekly learning summary

    1. This week's learning summary 1.1 Object oriented learning is over , Please use mind map , To encapsulate . Inherit . Draw a mind map or related notes for the core concepts , Make a summary of the object-oriented thinking . notes 1: No more keywords and content , But the connection between concepts needs to be clear ...