Error Writing output file |
尚未結案
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
暗黑破壞神
版主 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
暗黑破壞神
版主 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
暗黑破壞神
版主 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
不好意思。 下面是完整的程式:
謝謝你的回覆~
// initiate the vale of coefficients #define Cap_width 80 #define Cap_height 60 #define WIDTH 320 #define HEIGHT 240 // define the parameters of captured video CAPSTATUS CapStatus; CAPTUREPARMS CapParms; CAPDRIVERCAPS CapDrvCaps; HWND hCapWnd; int FramePerSec=30; // Bitmap format static BITMAPINFOHEADER BitmapHead; static BITMAPINFO BitmapInfo; static BITMAPFILEHEADER BitmapFileHead; int BIHsize; // define the subfunctions LRESULT CALLBACK FrameCallBack( HWND hwnd, Longint lpvhdr ); // Image subtraction int FrameInterval=4; int Frames=1; int ADF[WIDTH][HEIGHT]; int REF[WIDTH][HEIGHT]; //*************************************************************************** TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Disconnect_buttonClick(TObject *Sender) { capCaptureAbort(hCapWnd); capDriverDisconnect(hCapWnd); capSetCallbackOnVideoStream(hCapWnd,NULL); DestroyWindow(hCapWnd); // initiate the color of image to be black Image1->Canvas->Brush->Color=(TColor) 0x000000; Image1->Canvas->FillRect(Form1->ClientRect); } //--------------------------------------------------------------------------- void __fastcall TForm1::connect_buttonClick(TObject *Sender) { hCapWnd = capCreateCaptureWindow("Capture Window", WS_CHILD | WS_VISIBLE, 0,0,Cap_width,Cap_height, Panel1->Handle, (int) 0); bool connect = false; for(int i=0;i<10;i ) { connect=capDriverConnect(hCapWnd,i); if( connect ) break; } if( !connect ) ShowMessage("Connection with webcam is failure"); capCaptureGetSetup(hCapWnd ,&CapParms, sizeof(CapParms)); CapParms.dwRequestMicroSecPerFrame=33334; capCaptureSetSetup(hCapWnd ,&CapParms, sizeof(CapParms)); capGetStatus(hCapWnd , &CapStatus , sizeof(CapStatus)); CapStatus.uiImageWidth=Cap_width; CapStatus.uiImageHeight=Cap_height; capPreviewRate(hCapWnd,1000/FramePerSec); capPreviewScale(hCapWnd,true); capPreview(hCapWnd,true); BIHsize=capGetVideoFormatSize( hCapWnd ); capGetVideoFormat( hCapWnd, &BitmapHead, BIHsize); BitmapInfo.bmiHeader=BitmapHead; BitmapInfo.bmiHeader.biWidth=Cap_width; BitmapInfo.bmiHeader.biHeight=Cap_height; BitmapInfo.bmiHeader.biBitCount=24; BitmapInfo.bmiHeader.biSize=230400; capGetVideoFormat( hCapWnd, &BitmapInfo, capGetVideoFormatSize(hCapWnd)); } //--------------------------------------------------------------------------- void __fastcall TForm1::Start_buttonClick(TObject *Sender) { capSetCallbackOnFrame(hCapWnd, &FrameCallBack); } //--------------------------------------------------------------------------- void __fastcall TForm1::Stop_buttonClick(TObject *Sender) { capSetCallbackOnFrame (hCapWnd, NULL); } //--------------------------------------------------------------------------- LRESULT CALLBACK FrameCallBack( HWND hCapWnd, Longint lpvhdr ) { LPVIDEOHDR VideoStr; VideoStr=LPVIDEOHDR(lpvhdr); byte *ptr,*ptr1,*ptr2,*ptr3,*ptr4,*ptr5,*ptr6; Graphics::TBitmap *FrameBmp=new Graphics::TBitmap(); FrameBmp->Width=WIDTH; FrameBmp->Height=HEIGHT; FrameBmp->PixelFormat=pf24bit;; int k=0; for (int h=0;h |
暗黑破壞神
版主 發表:9 回覆:2301 積分:1627 註冊:2004-10-04 發送簡訊給我 |
|
JerryKuo
版主 發表:42 回覆:571 積分:322 註冊:2003-03-10 發送簡訊給我 |
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
|
JerryKuo
版主 發表:42 回覆:571 積分:322 註冊:2003-03-10 發送簡訊給我 |
|
yplin
一般會員 發表:9 回覆:16 積分:5 註冊:2004-08-07 發送簡訊給我 |
引言: 不好意思。 下面是完整的程式: 謝謝你的回覆~// initiate the vale of coefficients #define Cap_width 80 #define Cap_height 60 #define WIDTH 320 #define HEIGHT 240 // define the parameters of captured video CAPSTATUS CapStatus; CAPTUREPARMS CapParms; CAPDRIVERCAPS CapDrvCaps; HWND hCapWnd; int FramePerSec=30; // Bitmap format static BITMAPINFOHEADER BitmapHead; static BITMAPINFO BitmapInfo; static BITMAPFILEHEADER BitmapFileHead; int BIHsize; // define the subfunctions LRESULT CALLBACK FrameCallBack( HWND hwnd, Longint lpvhdr ); // Image subtraction int FrameInterval=4; int Frames=1; int ADF[WIDTH][HEIGHT]; int REF[WIDTH][HEIGHT]; //*************************************************************************** TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Disconnect_buttonClick(TObject *Sender) { capCaptureAbort(hCapWnd); capDriverDisconnect(hCapWnd); capSetCallbackOnVideoStream(hCapWnd,NULL); DestroyWindow(hCapWnd); // initiate the color of image to be black Image1->Canvas->Brush->Color=(TColor) 0x000000; Image1->Canvas->FillRect(Form1->ClientRect); } //--------------------------------------------------------------------------- void __fastcall TForm1::connect_buttonClick(TObject *Sender) { hCapWnd = capCreateCaptureWindow("Capture Window", WS_CHILD | WS_VISIBLE, 0,0,Cap_width,Cap_height, Panel1->Handle, (int) 0); bool connect = false; for(int i=0;i<10;i ) { connect=capDriverConnect(hCapWnd,i); if( connect ) break; } if( !connect ) ShowMessage("Connection with webcam is failure"); capCaptureGetSetup(hCapWnd ,&CapParms, sizeof(CapParms)); CapParms.dwRequestMicroSecPerFrame=33334; capCaptureSetSetup(hCapWnd ,&CapParms, sizeof(CapParms)); capGetStatus(hCapWnd , &CapStatus , sizeof(CapStatus)); CapStatus.uiImageWidth=Cap_width; CapStatus.uiImageHeight=Cap_height; capPreviewRate(hCapWnd,1000/FramePerSec); capPreviewScale(hCapWnd,true); capPreview(hCapWnd,true); BIHsize=capGetVideoFormatSize( hCapWnd ); capGetVideoFormat( hCapWnd, &BitmapHead, BIHsize); BitmapInfo.bmiHeader=BitmapHead; BitmapInfo.bmiHeader.biWidth=Cap_width; BitmapInfo.bmiHeader.biHeight=Cap_height; BitmapInfo.bmiHeader.biBitCount=24; BitmapInfo.bmiHeader.biSize=230400; capGetVideoFormat( hCapWnd, &BitmapInfo, capGetVideoFormatSize(hCapWnd)); } //--------------------------------------------------------------------------- void __fastcall TForm1::Start_buttonClick(TObject *Sender) { capSetCallbackOnFrame(hCapWnd, &FrameCallBack); } //--------------------------------------------------------------------------- void __fastcall TForm1::Stop_buttonClick(TObject *Sender) { capSetCallbackOnFrame (hCapWnd, NULL); } //--------------------------------------------------------------------------- LRESULT CALLBACK FrameCallBack( HWND hCapWnd, Longint lpvhdr ) { LPVIDEOHDR VideoStr; VideoStr=LPVIDEOHDR(lpvhdr); byte *ptr,*ptr1,*ptr2,*ptr3,*ptr4,*ptr5,*ptr6; Graphics::TBitmap *FrameBmp=new Graphics::TBitmap(); FrameBmp->Width=WIDTH; FrameBmp->Height=HEIGHT; FrameBmp->PixelFormat=pf24bit;; int k=0; for (int h=0;h此行即是外加的程式 ADF[w][h]= ADF[w][h] DiffValue; |
JerryKuo
版主 發表:42 回覆:571 積分:322 註冊:2003-03-10 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |