Ask Your Question

Revision history [back]

So this should be at least

// CHANGED header structure in OpenCV3.0
#include <opencv2\highgui.hpp>
#include <opencv2\videoio.hpp>
#include <opencv2\imgcodecs.hpp>

// make sure you use the OpenCV namespace
using namespace cv;

int main()
{
    VideoCapture capture(0);
    Mat current_frame;
    while (true) {
        capture >> current_frame;
        if ( frame.emty() ) break;
        imshow("Webcam", frame);
        int key = waitKey(33) && 0xFF;
        if (key == 27) break;
    }
    return 0;
}

Try this first and stay away from the arcane C-API...

So this should be at least

// CHANGED header structure in OpenCV3.0
#include <opencv2\highgui.hpp>
#include <opencv2\videoio.hpp>
#include <opencv2\imgcodecs.hpp>

// make sure you use the OpenCV namespace
using namespace cv;

int main()
{
    VideoCapture capture(0);
    Mat current_frame;
    while (true) {
        capture >> current_frame;
        if ( frame.emty()  current_frame.emty() ) break;
        imshow("Webcam", frame);
 current_frame);
        int key = waitKey(33) && 0xFF;
        if (key == 27) break;
    }
    return 0;
}

Try this first and stay away from the arcane C-API...

So this should be at least

// CHANGED header structure in OpenCV3.0
#include <opencv2\highgui.hpp>
#include <opencv2\videoio.hpp>
#include <opencv2\imgcodecs.hpp>

// ADD this to disable OpenCL explicitly
#include <opencv2/core/ocl.hpp>

// make sure you use the OpenCV namespace
using namespace cv;

int main()
{
    // Disable OpenCL explicitly here
    ocl::setUseOpenCL(false);

    VideoCapture capture(0);
    Mat current_frame;
    while (true) {
        capture >> current_frame;
        if (  current_frame.emty() ) break;
        imshow("Webcam",  current_frame);
        int key = waitKey(33) && 0xFF;
        if (key == 27) break;
    }
    return 0;
}

Try this first and stay away from the arcane C-API...