請大家救救我吧!我寫了一個多執行緒的程式,用來判斷影像是否有移動,只要移動就會錄影
不動就停止錄影,但是一但錄影的時候,就不能動作,不能比較圖片,請大家救救我吧
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "vfw.h"
#include "jpeg.hpp"
#include <Clipbrd.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
HWND hCapWnd;
BITMAPINFO bmi;
CAPTUREPARMS CaptureParms;
int width,height,ss,mm,hh,dd;
bool flag;
double compare;
static double basic;
static int cout;
TMyThread *MyThread,*MyThread1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
width=320;
height=240;
hCapWnd = capCreateCaptureWindow("My Capture Window", WS_CHILD | WS_VISIBLE,0, 0, width, height,Form1->Panel1->Handle, 0 );
bool a = false;
for( int i = 0; i < 10; i++ )
{
a = capDriverConnect( hCapWnd, i );
if( a ) break;
}
if( !a )
{
ShowMessage("攝影機連接失敗..");
}
capOverlay(hCapWnd, true);
capPreview(hCapWnd,true);
capPreviewScale(hCapWnd,true);
capPreviewRate(hCapWnd, 1000/30);
capGetVideoFormat(hCapWnd, &bmi, sizeof(BITMAPINFO));
bmi.bmiHeader.biWidth=width;
bmi.bmiHeader.biHeight=height;
SetWindowPos(hCapWnd, 0, 0, 0, bmi.bmiHeader.biWidth,bmi.bmiHeader.biHeight,0);
Form1->Panel1->ClientHeight=bmi.bmiHeader.biHeight;
Form1->Panel1->ClientWidth=bmi.bmiHeader.biWidth;
basic=0;
compare=0;
flag=false;
}
//---------------------------------------------------------------------------
_fastcall TMyThread::TMyThread(void):TThread(true)
{
Resume();
}
void __fastcall TM ..
訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容