Problems with using objects of Mat

asked 2015-12-06 05:24:38 -0500

Chana gravatar image

updated 2015-12-06 05:37:06 -0500

berak gravatar image

I'm trying to run the attached code, and I'm getting errors about the objects of the class Mat. I tried adding the file Mat.hpp to the code and it didn't help. though the code itself isn't problematic- other pepole on that forum used it and it worked. so I guess something's wrong with how I'm using the class or with how I'm using openCV in general. If someone can guide me I'll be very happy. Thank you very much!!!

link text

edit retag flag offensive close merge delete

Comments

2

please forget that link immediately, it's horribly outdated, and code like that should no more be used.

instead, please have a look at the tutorials

berak gravatar imageberak ( 2015-12-06 05:36:20 -0500 )edit

you can use :

#include "opencv2/opencv.hpp"

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;

    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera

        imshow("VideoCapture Basic Demo", frame);

        if(waitKey(30) >= 0) break;
    }
    // the camera will be deinitialized automatically in VideoCapture destructor
    return 0;
}
sturkmen gravatar imagesturkmen ( 2015-12-06 06:27:08 -0500 )edit