i'm trying use opencv connect basler aca2500-14gm gige camera ,but working basler pylon 4 , opencv version 2.4.9 , problems, make c++ code have error. os ubuntu14.04
i grateful if 1 me please thanks.
here error: error: ‘hwnd’ not name type hwnd getwindowhandle() const;
here code:
enter code here
#include <pylon/pylonincludes.h> #include <pylon/pylongui.h> using namespace pylon; using namespace std; static const uint32_t c_countofimagestograb = 100; int main(int argc, char* argv[]) { int exitcode = 0; pylon runtime system pylon::pylonautoinitterm autoinitterm; try { cinstantcamera camera( ctlfactory::getinstance().createfirstdevice()); cout << "using device " << camera.getdeviceinfo().getmodelname() << endl; buffers camera.maxnumbuffer = 5; camera.startgrabbing( c_countofimagestograb); cgrabresultptr ptrgrabresult; retrieveresult() method while ( camera.isgrabbing()) { ms used. camera.retrieveresult( 5000, ptrgrabresult, timeouthandling_throwexception); if (ptrgrabresult->grabsucceeded()) { cout << "sizex: " << ptrgrabresult->getwidth() << endl; cout << "sizey: " << ptrgrabresult->getheight() << endl; const uint8_t *pimagebuffer = (uint8_t *) ptrgrabresult->getbuffer(); cout << "gray value of first pixel: " << (uint32_t) pimagebuffer[0] << endl << endl; #ifdef pylon_win_build pylon::displayimage(1, ptrgrabresult); #endif } else { cout << "error: " << ptrgrabresult->geterrorcode() << " " << ptrgrabresult->geterrordescription() << endl; } } } catch (genicam::genericexception &e) { cerr << "an exception occurred." << endl << e.getdescription() << endl; exitcode = 1; } cerr << endl << "press enter exit." << endl; while( cin.get() != '\n'); return exitcode; }
first, i'd recommend use pleora's sdk on basler's gigevision - it's more safe other camera uses , designed , implemented better vendor specific sdks , has seen more usage. require license remove watermark. have no association pleora.
the example you've posted looks incomplete error indicates sdk thinks compiling in windows. has nothing opencv , has pylongui.h include, try guarding in #ifdef pylon_win_build.