Image 01
profile-image

xairoy

Sirsendu Roy
test
Qt Opencv webcam viewer

Webcam & Monitoring 21 comments

Score 67.1%
Sep 24 2008
Hallo,
I have downloaded the code and tried to extend it in which I added two buttons "START RECORDING" and "STOP RECORDING" recording. When I pressed the "START RECORDING" button, i start another timer in which I capture the frame and save it in a QQueue<QQueue<IplImage*> imageQueue.

It has worked, it seems.
Now when I press the "STOP RECODING" Button, i tried to write the capture to a video file.
following is the code:

void MyCameraWindow::StopRec()
{
InitializeWrite();
IplImage* img = 0;
for (int i=0 ;i<imageQueue.length();i++)
{
img=imageQueue.dequeue();

cvWriteFrame(writer,img);
cvWaitKey(20);
}
tmrStart->stop();
btnStartRecording->setVisible(true);
btnStopRecording->setEnabled(false);

}

void MyCameraWindow::InitializeWrite()
{
writer = 0;
int isColor = 1;
int fps = 25;
int frameW = 640;
int frameH = 480;
writer=cvCreateVideoWriter("out.avi",CV_FOURCC('P','I','M','1'),
fps,cvSize(frameW,frameH),isColor);

}
when I debug step by step the code works until cvWriteFrame(writer,img);
I have checked the writer is not null and the img as well. when I execute cvWriteFrame(writer,img ), I get the error in qglobal.h file on line 2188.
please help.
Roy - Nov 29 2010