Hsmlee
Hsmlee

Reputation: 61

How to detect the landmarks in a video by using OpenCV_Contrib?

I'm using OpenCV_Contrib to detect the face landmarks.

It detects the landmarks of image.

However, I'm trying to find out how I can detect the face landmarks from Video.

*Only using OpenCV_Contrib.

Anyone who knows it, please give me the answer!

Upvotes: 0

Views: 194

Answers (1)

Mick
Mick

Reputation: 25481

I may have misunderstood your question, but using openCV with a video generally involves capturing each frame and the doing your image processing and object detection etc on each individual frame.

For example, this is the method called to detect colour regions in the Android OpenCV Colour Blob detection example(https://github.com/opencv/opencv/tree/master/samples/android/color-blob-detection/src/org/opencv/samples/colorblobdetect). As the name implies it is called for every frame (in this case from a live preview camera):

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
        mRgba = inputFrame.rgba();

        if (mIsColorSelected) {
            mDetector.process(mRgba);
            List<MatOfPoint> contours = mDetector.getContours();
            Log.e(TAG, "Contours count: " + contours.size());
            Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR);

            Mat colorLabel = mRgba.submat(4, 68, 4, 68);
            colorLabel.setTo(mBlobColorRgba);

            Mat spectrumLabel = mRgba.submat(4, 4 + mSpectrum.rows(), 70, 70 + mSpectrum.cols());
            mSpectrum.copyTo(spectrumLabel);
        }

        return mRgba;
    }

Upvotes: 1

Related Questions