1. VideoCaputre

Class for video capturing from video files, image sequences or cameras. The class provides C++ API for capturing video from cameras or for reading video files and image sequences. Here is how the class can be used:

videoCapture constructors.

circle-info
  1. videoCapture::VideoCapture()

  2. videoCapture::VideoCapture(const string& filename)

  3. VideoCapture::VideoCapture(int device)

Read Camera example

#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>

int main(int argc, const char** argv)
{
    cv::VideoCapture    capture;
    cv::Mat             frame;

    capture.open(0);

    if (!capture.isOpened())
    {
        std::cout << "[DEBUG] open video capture error\n";
        return -1;
    }

    while (capture.read(frame))
    {
        if (frame.empty())
        {
            std::cout << "[DEBUG] No captured frame -- Break!\n";
            break;
        }

        if (cv::waitKey(30) == 27)
            break;
        cv::imshow("Capture - Face detection", frame);
    }
    return 0;
}

Morphological Gradient

Face Detection using Haar Cascades

Last updated