截取人臉 |
尚未結案
|
639673
一般會員 發表:36 回覆:4 積分:8 註冊:2005-05-15 發送簡訊給我 |
各位大大~不好意思~我知道這個問題已經有很多解說和回應~但是一旦將橢圓模組加入我的程式裡就是怎樣都不能動~請各位大大幫個忙~看看哪裡需要加~又該怎加~感恩唷!!
void __fastcall TForm1::Btn_PREVIEWClick(TObject *Sender)
{
capPreviewRate(hCapWnd, 1000/30); //每秒影像變化張數
Timer1->Interval=33;
hCapWnd = capCreateCaptureWindow("My Capture Window",
WS_CHILD | WS_VISIBLE,
0, 0,
ImageWidth,
ImageHeight,
Form1->Panel1->Handle,
0 ); for(ConnectDeviceIndex=0; ConnectDeviceIndex<10; ConnectDeviceIndex )
if (capDriverConnect(hCapWnd, ConnectDeviceIndex))
break; if(ConnectDeviceIndex>=10) ShowMessage("攝影機連接失敗..");
else
{
capGetVideoFormat(hCapWnd, &bmi, sizeof(BITMAPINFO));
bmi.bmiHeader.biWidth=320;
bmi.bmiHeader.biHeight=240;
if (capSetVideoFormat(hCapWnd, &bmi, sizeof(BITMAPINFO)))
{
capDriverDisconnect(hCapWnd);
capDriverConnect(hCapWnd, ConnectDeviceIndex);
} capOverlay(hCapWnd, true);
capPreviewScale(hCapWnd,true);
capPreviewRate(hCapWnd, 1000/30);
capGetVideoFormat(hCapWnd, &bmi, sizeof(BITMAPINFO));
SetWindowPos(hCapWnd, 0, 0, 0, bmi.bmiHeader.biWidth,bmi.bmiHeader.biHeight, 0);
// capPreview(hCapWnd,true);
} Timer1->Enabled=true;
Btn_STOP->Enabled=true;
Btn_PREVIEW->Enabled=false;
//CheckBox1->Enabled=true;
} void __fastcall TForm1::Btn_STOPClick(TObject *Sender)
{
Timer1->Enabled = false;
capPreview(hCapWnd, false);
capDriverDisconnect(hCapWnd);
Btn_STOP->Enabled=false;
Btn_PREVIEW->Enabled=true;
//CheckBox1->Enabled=false;
} void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Timer1->Enabled=false;
capGrabFrameNoStop(hCapWnd);
capEditCopy(hCapWnd);
//if(Clipboard()->HasFormat(CF_DIB))
//Image3->Picture->Bitmap->Assign(Clipboard());
//Bitmap1->Assign(Image3->Picture); //if (CheckBox1->Checked==true)
//Button2Click(Sender); Timer1->Enabled=true;
} void __fastcall TForm1::Btn_SOURCEClick(TObject *Sender)
{
capDlgVideoSource(hCapWnd);
} void __fastcall TForm1::Btn_FORMATClick(TObject *Sender)
{
capDlgVideoFormat(hCapWnd);
}
void __fastcall TForm1::Btn_COMPRESSIONClick(TObject *Sender)
{
capDlgVideoCompression(hCapWnd);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String PicName = "C:\\" Now().FormatString("yyyymmddhhnnss") ".avi";
capFileSetCaptureFile(hCapWnd,PicName.c_str());//預設檔案名稱及位置
capFileSaveAs(hCapWnd,PicName.c_str());
capCaptureSequence(hCapWnd); //若無上述函數,將在c:\產生capture.avi
//capFileSaveDIB(hCapWnd,PicName.c_str());
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Form1->DoubleBuffered = true;
Panel1->DoubleBuffered = true;
Btn_STOP->Enabled = false;
ImageWidth=320;
ImageHeight=240;
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if (Btn_PREVIEW->Enabled==true)
capGrabFrame(hCapWnd);
String PicName = "C:\\" Now().FormatString("yyyymmddhhnnss") ".bmp";
capFileSaveDIB(hCapWnd,PicName.c_str());
} void __fastcall TForm1::Button3Click(TObject *Sender)
{
if(OpenPictureDialog1->Execute())
{ Image2->Picture->LoadFromFile(OpenPictureDialog1->FileName);
}
}
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |