Ask Your Question

Revision history [back]

Video window not loading frame

I know this question has been asked multiple times but none of the solutions have worked for my context plus my window is actually getting loaded.

When I run this program, the webcam lights up and the window actually appears but without the footage. The same thing happens when I try to load an image. I tried with and without the namedWindow() method but still no luck. My frame matrix consists of data and everything seems to run smoothly with exception to actually displaying the image/video.

#include <iostream>
#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

VideoCapture cap(0);

Mat grabVideoFeed()
{
    if (!cap.isOpened()) return Mat();

    Mat frame;
    cap.read(frame);

    return frame;
}

int main(int argc, const char * argv[])
{
    for(;;)
    {
        Mat frame = grabVideoFeed();

        if (frame.empty()) break;

        namedWindow("Main", CV_WINDOW_AUTOSIZE);
        imshow("Main", frame);

        if (waitKey(30) >= 0) break;
    }

    cap.release();
    destroyAllWindows();

    return 0;
}

When I execute this program, the created window looks like this.Window is loaded but no image is shown.

I compiled OpenCV3.2.0 from source and running it on Mac OS Sierra

Video window not loading frame

I know this question has been asked multiple times but none of the solutions have worked for my context plus my window is actually getting loaded.

When I run this program, the webcam lights up and the window actually appears but without the footage. The same thing happens when I try to load an image. I tried with and without the namedWindow() method but still no luck. My frame matrix consists of data and everything seems to run smoothly with exception to actually displaying the image/video.

I compiled OpenCV3.2.0 from source and running it on Mac OS Sierra.

#include <iostream>
#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

VideoCapture cap(0);

Mat grabVideoFeed()
{
    if (!cap.isOpened()) return Mat();

    Mat frame;
    cap.read(frame);

    return frame;
}

int main(int argc, const char * argv[])
{
    for(;;)
    {
        Mat frame = grabVideoFeed();

        if (frame.empty()) break;

        namedWindow("Main", CV_WINDOW_AUTOSIZE);
        imshow("Main", frame);

        if (waitKey(30) >= 0) break;
    }

    cap.release();
    destroyAllWindows();

    return 0;
}

When I execute this program, the created window looks like this.Window is loaded but no image is shown.

I compiled OpenCV3.2.0 from source and running it on Mac OS Sierra

Video window not loading frame

I know this question has been asked multiple times but none of the solutions have worked for my context plus my window is actually getting loaded.

When I run this program, the webcam lights up and the window actually appears but without the footage. The same thing happens when I try to load an image. I tried with and without the namedWindow() method but still no luck. My frame matrix consists of data and everything seems to run smoothly with exception to actually displaying the image/video.

I compiled OpenCV3.2.0 from source and running it on Mac OS Sierra.

#include <iostream>
#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

VideoCapture cap(0);

Mat grabVideoFeed()
void grabVideoFeed(Mat& frame)
{
    if (!cap.isOpened()) return Mat();

    Mat frame;
cerr << "Issue grabbing camera";

    cap.read(frame);

    return frame;
}

int main(int argc, const char * argv[])
{
    Mat frame;

    for(;;)
    {
        Mat frame = grabVideoFeed();
grabVideoFeed(frame);

        if (frame.empty()) break;

        namedWindow("Main", CV_WINDOW_AUTOSIZE);
        imshow("Main", frame);

        if (waitKey(30) >= 0) break;
    }

    cap.release();
    destroyAllWindows();

    return 0;
}

When I execute this program, the created window looks like this.Window is loaded but no image is shown.