我正在尝试使用opencv连接到basler am 2500-14‘m相机,但我正在使用Basler Pylon 4和OPENCV版本2.4.9和一些问题,使我的c++代码有错误。我的os ubuntu14.04
如果有人能帮我,我将非常感激,谢谢。
这里是错误:错误:‘HWND’没有命名类型HWND GetWindowHandle() const;
这是我的代码:
在这里输入代码
#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;
which
camera.StartGrabbing( c_countOfImagesToGrab);
CGrabResultPtr ptrGrabResult;
RetrieveResult() method
while ( camera.IsGrabbing())
{
ms is 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 to exit." << endl;
while( cin.get() != '\n');
return exitCode;
}发布于 2015-04-29 07:30:13
首先,我建议您在GigeVision上使用Pleora的SDK而不是Basler的SDK--与厂商特定的SDK相比,它对其他相机的使用更安全,设计和实现也更好,并且已经有了更多的使用。但是,它确实需要许可证才能删除水印。我和普罗拉没有任何关系。
您发布的示例看起来不完整,但您的错误表明SDK认为您正在windows中编译。这与OpenCV无关,与PylonGUI.h包含有关,请尝试在#ifdef PYLON_WIN_BUILD中保护它。
https://stackoverflow.com/questions/29911283
复制相似问题