Ask Your Question

PaulMakesThings's profile - activity

2016-09-30 19:22:44 -0600 received badge  Supporter (source)
2016-08-29 17:50:24 -0600 asked a question Interlacing issue with HDMI capture using Avermedia ExtremeCAP U3

Hi

I'm using a basic color filtering example (pasted at the bottom)

I'm using a GoPro Hero 4 silver, and to capture the video in real time I have it connected by HDMI to an AverMedia ExtremeCap U3 device. It is compatible with direct show and connects through USB 3.0. I'm using openCV 3.1.0 and Visual Studio Community 2015.

I've verified that the capture device streams properly through it's own application and that OpenCV is capturing ok with a 1080p USB webcam and with my laptop's built in webcam.

Here is what the image looks like in the Avermedia RECentral application supplied with the video capture device

image description

Here is what I'm getting when I open it in OpenCV

image description

I've tried setting the camera to 60 or 30 fps, and 1080p, 720p, and wxga with similar results.

From what I can tell it looks like two smaller portions of the image interlaced over each other. I'm looking into different capture methods or drivers that could change this but if anyone knows what might cause this or how to fix it some help would be great.

Thanks!

The code I'm testing on is this example: http://opencv-srf.blogspot.in/2010/09...

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

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    VideoCapture cap(0); //capture the video from web cam

    if (!cap.isOpened())  // if not success, exit program
    {
        cout << "Cannot open the web cam" << endl;
        return -1;
    }

    namedWindow("Control", CV_WINDOW_AUTOSIZE); //create a window called "Control"

    int iLowH = 0;
    int iHighH = 179;

    int iLowS = 0;
    int iHighS = 255;

    int iLowV = 0;
    int iHighV = 255;

    //Create trackbars in "Control" window
    cvCreateTrackbar("LowH", "Control", &iLowH, 179); //Hue (0 - 179)
    cvCreateTrackbar("HighH", "Control", &iHighH, 179);

    cvCreateTrackbar("LowS", "Control", &iLowS, 255); //Saturation (0 - 255)
    cvCreateTrackbar("HighS", "Control", &iHighS, 255);

    cvCreateTrackbar("LowV", "Control", &iLowV, 255); //Value (0 - 255)
    cvCreateTrackbar("HighV", "Control", &iHighV, 255);

    while (true)
    {
        Mat imgOriginal;

        bool bSuccess = cap.read(imgOriginal); // read a new frame from video

        if (!bSuccess) //if not success, break loop
        {
            cout << "Cannot read a frame from video stream" << endl;
            break;
        }

        Mat imgHSV;

        cvtColor(imgOriginal, imgHSV, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV

        Mat imgThresholded;

        inRange(imgHSV, Scalar(iLowH, iLowS, iLowV), Scalar(iHighH, iHighS, iHighV), imgThresholded); //Threshold the image

                                                                                                      //morphological opening (remove small objects from the foreground)
        erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
        dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));

        //morphological closing (fill small holes in the foreground)
        dilate(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));
        erode(imgThresholded, imgThresholded, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)));

        imshow("Thresholded Image", imgThresholded); //show the thresholded image
        imshow("Original", imgOriginal); //show the original image

        if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
        {
            cout << "esc key is pressed by user" << endl;
            break;
        }
    }

    return 0;

}