New user, need some basic help

asked 2015-02-01 22:46:32 -0600

pavanbabut gravatar image

I just started using OpenCV for my application which I am upgrading from VC++ 6 to VS2008 64bit. I successfully compiled the libraries in both 32bit and 64bit flavors and then wrote a simple Win32 application to read from a usb video grabber into a OpenCV Mat datatype and display it on OpenCV window. Everything seems working fine.

Now to include it to my program, all I want it to do is to grab frames from a framegrabber (for now). For this I want to do the following apart from doing the necessary stuff (videocapture, read etc)

I would like to assign the 'data' in my Mat to a user defined uchar* and read the frames directly into it for quick access. Is it possible to accomplish this? If so, how? Next, how can read the number of channels, bit depth and frame size?

thanks

edit retag flag offensive close merge delete

Comments

you mean to ask How to capture video from camera using opencv?

Balaji R gravatar imageBalaji R ( 2015-02-01 23:28:06 -0600 )edit
1
    Mat m1(h,w,CV_8UC3, data); // assumes bgr capture;
    // now, you probably do this in a callback function, 
    //  and your 'data' ptr will go out of scope,
    //  thus we need a 'deep copy':
    Mat m2 = m1.clone();
berak gravatar imageberak ( 2015-02-02 01:00:38 -0600 )edit

Thanks for the replies, but I am more specifically looking to know how to copy the Mat.data into a user defined buffer or even more to assign a user defined buffer to Mat.data, I got the rest as to how to capture frames from camera and so on.

pavanbabut gravatar imagepavanbabut ( 2015-02-02 10:32:19 -0600 )edit