欢迎来到天天文库
浏览记录
ID:48039394
大小:88.94 KB
页数:4页
时间:2020-02-07
《BASLER GIGE相机 怎么使用OPENCV显示图像.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、baslergige相机怎么使用opencv显示图像这个是官方的例子,我把头文件,库都配好后,可以运行。但是它直接调用的是pylon的窗口,现在我想用opencv的窗口来显示他#include#include//Namespaceforusingpylonobjects.usingnamespacePylon;//Namespaceforusingcout.usingnamespacestd;//Numberofimagestobegrabbed.staticconstuint32_tc_countOfImag
2、esToGrab=100;intmain(intargc,char*argv[]){//Theexitcodeofthesampleapplication.intexitCode=0;//AutomagicallycallPylonInitializeandPylonTerminatetoensurethepylonruntimesystem//isinitializedduringthelifetimeofthisobject.Pylon::PylonAutoInitTermautoInitTerm;try{//Createaninstantcameraobjectwiththecamer
3、adevicefoundfirst.CInstantCameracamera(CTlFactory::GetInstance().CreateFirstDevice());//Printthemodelnameofthecamera.cout<<"Usingdevice"<4、0.camera.MaxNumBuffer=5;//Startthegrabbingofc_countOfImagesToGrabimages.//Thecameradeviceisparameterizedwithadefaultconfigurationwhich//setsupfree-runningcontinuousacquisition.camera.StartGrabbing(c_countOfImagesToGrab);//Thissmartpointerwillreceivethegrabresultdata.CGrabResultPtrptrGrabResult;//Ca5、mera.StopGrabbing()iscalledautomaticallybytheRetrieveResult()method//whenc_countOfImagesToGrabimageshavebeenretrieved.while(camera.IsGrabbing()){//Waitforanimageandthenretrieveit.Atimeoutof5000msisused.camera.RetrieveResult(5000,ptrGrabResult,TimeoutHandling_ThrowException);//Imagegrabbedsuccessful6、ly?if(ptrGrabResult->GrabSucceeded()){//Accesstheimagedata.cout<<"SizeX:"<GetWidth()<GetHeight()<GetBuffer();cout<<"Grayvalueoffirstpixel:"<<(uint32_t)pImageBuffer[0]<7、hegrabbedimage.Pylon::DisplayImage(1,ptrGrabResult);}else{cout<<"Error:"<GetErrorCode()<<""<GetErrorDescription();}}}catch(GenICam::GenericException&e){//Errorhandling.cerr<<
4、0.camera.MaxNumBuffer=5;//Startthegrabbingofc_countOfImagesToGrabimages.//Thecameradeviceisparameterizedwithadefaultconfigurationwhich//setsupfree-runningcontinuousacquisition.camera.StartGrabbing(c_countOfImagesToGrab);//Thissmartpointerwillreceivethegrabresultdata.CGrabResultPtrptrGrabResult;//Ca
5、mera.StopGrabbing()iscalledautomaticallybytheRetrieveResult()method//whenc_countOfImagesToGrabimageshavebeenretrieved.while(camera.IsGrabbing()){//Waitforanimageandthenretrieveit.Atimeoutof5000msisused.camera.RetrieveResult(5000,ptrGrabResult,TimeoutHandling_ThrowException);//Imagegrabbedsuccessful
6、ly?if(ptrGrabResult->GrabSucceeded()){//Accesstheimagedata.cout<<"SizeX:"<GetWidth()<GetHeight()<GetBuffer();cout<<"Grayvalueoffirstpixel:"<<(uint32_t)pImageBuffer[0]<7、hegrabbedimage.Pylon::DisplayImage(1,ptrGrabResult);}else{cout<<"Error:"<GetErrorCode()<<""<GetErrorDescription();}}}catch(GenICam::GenericException&e){//Errorhandling.cerr<<
7、hegrabbedimage.Pylon::DisplayImage(1,ptrGrabResult);}else{cout<<"Error:"<GetErrorCode()<<""<GetErrorDescription();}}}catch(GenICam::GenericException&e){//Errorhandling.cerr<<
此文档下载收益归作者所有