E2193 Too few parameters in call to '_fastcall TBitmap :: GetScanline(int)' |
尚未結案
|
amap0920g
一般會員 發表:6 回覆:5 積分:2 註冊:2015-10-28 發送簡訊給我 |
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
amap0920g
一般會員 發表:6 回覆:5 積分:2 註冊:2015-10-28 發送簡訊給我 |
|
amap0920g
一般會員 發表:6 回覆:5 積分:2 註冊:2015-10-28 發送簡訊給我 |
|
taishyang
站務副站長 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
amap0920g
一般會員 發表:6 回覆:5 積分:2 註冊:2015-10-28 發送簡訊給我 |
可我打這行之後 ptr[0] = pBitmap->ScanLine[i]; ,出現更多的錯誤,我附上程式,可以幫我看該如何解決嗎?
//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit1.h" #include #include "gige_cpp/GigEVisionSDK.h" #include "gige_cpp/GigEVisionSDK.cpp" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; int mwidth; int mheight; bool fg; int ct; bool status; gige::IDevice device = NULL; gige::IGigEVisionAPI gigeApi; gige::IImageProcAPI imageProcApi; gige::IAlgorithm colorPipelineAlg; gige::IParams colorPipelineParams; gige::IResults colorPipelineResults; gige::IImageBitmap colorPipelineBitmap; gige::IAlgorithm colorGimpAlg; gige::IParams colorGimpParams; gige::IResults colorGimpResults; gige::IImageBitmap outputBitmap; Graphics::TBitmap *pBitmap; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- // IPv4 address conversion to string String IpAddrToString(UINT32 IpAddr) { UINT32 temp1, temp2, temp3, temp4; String mIpAddr; temp1 = ((IpAddr >> 24) & 0xFF); temp2 = ((IpAddr >> 16) & 0xFF); temp3 = ((IpAddr >> 8) & 0xFF); temp4 = ((IpAddr) & 0xFF); mIpAddr = IntToStr(temp1) "." IntToStr(temp2) "." IntToStr(temp3) "." IntToStr(temp4); return mIpAddr; } void __fastcall TForm1::FormShow(TObject *Sender) { INT64 value; std::string matrix; fg = true; gige::InitGigEVisionAPI(); gigeApi = gige::GetGigEVisionAPI(); gige::InitImageProcAPI(); imageProcApi = gige::GetImageProcAPI(); //Initialization colorPipelineAlg = imageProcApi->GetAlgorithmByName("ColorPipeline"); imageProcApi->CreateBitmap(&colorPipelineBitmap); colorPipelineAlg->CreateParams(&colorPipelineParams); colorPipelineAlg->CreateResults(&colorPipelineResults); colorGimpAlg = imageProcApi->GetAlgorithmByName("ColorGimp"); imageProcApi->CreateBitmap(&outputBitmap); colorGimpAlg->CreateParams(&colorGimpParams); colorGimpAlg->CreateResults(&colorGimpResults); colorGimpParams->SetFloatNodeValue("HueAll", 90); // min -180 max 180 default 0 colorGimpParams->SetFloatNodeValue("LightnessAll", 50); // min -100 max 100 default 0 colorGimpParams->SetFloatNodeValue("SaturationAll", 50); // min -100 max 100 default 0 colorGimpParams->SetFloatNodeValue("Overlay", 50); // min 0 max 100 default 0 if (!gigeApi->IsUsingKernelDriver()) { StatusBar1->SimpleText = "Warning: Could not load Smartek GigE Vision Filter Driver."; Button1->Enabled = false; } else { // discover all devices on network gigeApi->FindAllDevices(3.0); gige::DevicesList devices = gigeApi->GetAllDevices(); if (devices.size() > 0) { // take first device in list device = devices[0]; UINT32 address = device->GetIpAddress(); this->Text = "Smartek Camera address : " IpAddrToString(address); // if you want to change number of images in image buffer from default 10 images // call SetImageBufferFrameCount() method before Connect() method device->SetImageBufferFrameCount(20); status = device->Connect(); status = device->SetStringNodeValue("PixelFormat", "BayerRG8"); status = device->SetIntegerNodeValue("OffsetX", 0); status = device->SetIntegerNodeValue("OffsetY", 0); status = device->GetIntegerNodeValue("WidthMax", value); status = device->SetIntegerNodeValue("Width", value); mwidth = (int)value; status = device->GetIntegerNodeValue("HeightMax", value); status = device->SetIntegerNodeValue("Height", value); mheight = (int)value; status = device->SetStringNodeValue("TriggerSelector", "AcquisitionStart"); // disable trigger mode status = device->SetStringNodeValue("TriggerMode", "Off"); // set Continuous acquisition mode status = device->SetStringNodeValue("AcquisitionMode", "Continuous"); status = device->SetStringNodeValue("ExposureMode", "Timed"); status = device->SetFloatNodeValue("ExposureTime", 200000); // start acquisition status = device->SetIntegerNodeValue("TLParamsLocked", 1); pBitmap = new Graphics::TBitmap(); pBitmap->Width = mwidth; pBitmap->Height = mheight; pBitmap->PixelFormat = pf32bit; } else { StatusBar1->SimpleText = "No camera connected"; Button1->Enabled = false; } } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { this->Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { gige::IImageInfo imageInfo; void *ptr[2]; fg = false; if (device != NULL && device->IsConnected()) { if (device->WaitForImage(3.0)) { if (!device->IsBufferEmpty()) { device->GetImageInfo(&imageInfo); if (imageInfo != NULL) { imageProcApi->ExecuteAlgorithm(colorPipelineAlg, imageInfo, colorPipelineBitmap, colorPipelineParams, colorPipelineResults); imageProcApi->ExecuteAlgorithm(colorGimpAlg, colorPipelineBitmap, outputBitmap, colorGimpParams, colorGimpResults); if ((mwidth % 4) == 0) { SetBitmapBits(pBitmap->Handle,mwidth*mheight*4,(void *)outputBitmap->GetRawData(0)); } else { for(int i = 0; i < mheight; i ) { ptr[0] = pBitmap->ScanLine[i]; ptr[1] = (void *)outputBitmap->GetRawData((unsigned int)i); memcpy(ptr[0], ptr[1], mwidth*4); } } Image1->Picture->Assign(pBitmap); ct ; StatusBar1->SimpleText = TimeToStr(Time()) " Garb Frame Nums : " IntToStr(ct); } device->PopImage(imageInfo); } device->ClearImageBuffer(); } } else { StatusBar1->SimpleText = TimeToStr(Time()); } fg = true; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { if (Button1->Caption == "開始取像") { Button1->Caption = "停止取像"; ct = 0; status = device->CommandNodeExecute("AcquisitionStart"); Timer1->Enabled = true; } else { Timer1->Enabled = false; status = device->CommandNodeExecute("AcquisitionStop"); Button1->Caption = "開始取像"; } } //--------------------------------------------------------------------------- void __fastcall TForm1::Timer2Timer(TObject *Sender) { Timer2->Enabled = false; this->Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) { Timer1->Enabled = false; if (fg) { if (device != NULL && device->IsConnected()) { device->CommandNodeExecute("AcquisitionStop"); device->SetIntegerNodeValue("TLParamsLocked", 0); device->Disconnect(); delete pBitmap; } imageProcApi->DestroyBitmap(colorPipelineBitmap); colorPipelineAlg->DestroyParams(colorPipelineParams); colorPipelineAlg->DestroyResults(colorPipelineResults); imageProcApi->DestroyBitmap(outputBitmap); colorGimpAlg->DestroyParams(colorGimpParams); colorGimpAlg->DestroyResults(colorGimpResults); gige::ExitGigEVisionAPI(); gige::ExitImageProcAPI(); } else { Action = caFree; Timer2->Enabled = true; } } //---------------------------------------------------------------------------
編輯記錄
amap0920g 重新編輯於 2016-10-26 16:30:55, 註解 無‧
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |