1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
[...]
sprintf(load,"%s/result.avi",samp.c_str());
fperiod=1000/fps; //fps is frames per second, e.g. 25
HAVI avi = CreateAvi(load,int(fperiod),NULL);
while(true)
{
[unrelated code, editing frames from capture]
// saving the current frame:
sprintf(load,"%s/image.bmp",samp.c_str());
cvSaveImage(load,framex);
HBITMAP hbm=(HBITMAP)LoadImage(NULL,load,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
if (uu==0) // Set up compression just before the first frame
{ AVICOMPRESSOPTIONS opts; ZeroMemory(&opts,sizeof(opts));
SetAviVideoCompression(avi,hbm,&opts,true,hwnd);
}
AddAviFrame(avi,hbm);DeleteObject(hbm);
[unrelated code] uu=uu+1;
}
CloseAvi(avi);
|