首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OPENCV 2.4.9使用basler pylon4连接到basler gige摄像机和ubuntu14.04

OPENCV 2.4.9使用basler pylon4连接到basler gige摄像机和ubuntu14.04
EN

Stack Overflow用户
提问于 2015-04-28 05:47:41
回答 1查看 1.3K关注 0票数 0

我正在尝试使用opencv连接到basler am 2500-14‘m相机,但我正在使用Basler Pylon 4和OPENCV版本2.4.9和一些问题,使我的c++代码有错误。我的os ubuntu14.04

如果有人能帮我,我将非常感激,谢谢。

这里是错误:错误:‘HWND’没有命名类型HWND GetWindowHandle() const;

这是我的代码:

在这里输入代码

代码语言:javascript
复制
#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;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-29 07:30:13

首先,我建议您在GigeVision上使用Pleora的SDK而不是Basler的SDK--与厂商特定的SDK相比,它对其他相机的使用更安全,设计和实现也更好,并且已经有了更多的使用。但是,它确实需要许可证才能删除水印。我和普罗拉没有任何关系。

您发布的示例看起来不完整,但您的错误表明SDK认为您正在windows中编译。这与OpenCV无关,与PylonGUI.h包含有关,请尝试在#ifdef PYLON_WIN_BUILD中保护它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29911283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档