#include
#include
#include
using namespace std;
using namespace cv;
int main()
{
Mat frame, yuv;
VideoCapture capture;
int w = 320;
int h = 240;
capture.open(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH,w);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,h);
/*
VideoCapture capture;
int w = 1280;
int h = 720;
string filename = "./xx.mp4";
capture.open(filename);
*/
if(!capture.isOpened())
{
cerr << "No camera or video input!\n";
return -1;
}
int bufLen = w*h*3/2;
unsigned char* pYuvBuf = new unsigned char[bufLen];
FILE* pFileOut = fopen("xx.yuv", "wb");
if (!pFileOut)
{
printf("pFileOut open er