首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启动固件\SDK后无法在PTGRey摄像机(蜻蜓快车)上开始捕获

启动固件\SDK后无法在PTGRey摄像机(蜻蜓快车)上开始捕获
EN

Stack Overflow用户
提问于 2011-07-10 10:20:25
回答 2查看 9K关注 0票数 0

几个月来,我一直在使用点灰研究公司的蜻蜓快车相机。我已经编写了使用相机的代码,并用它获取图像。最近,我已经将固件和SDK从2更新到2.2,因为那时我无法使用我的代码获取图像。新的FlyCapture2控制面板(2.2)工作并能够使用相同的摄像机捕捉视频。具体来说,当我调用相机对象上的StartCapture时,我会收到一个错误。我正在粘贴我的程序的输出,然后我将添加相关的摄像机代码:

*相机信息*系列- 7340769相机型号-蜻蜓快车DX-BW相机供应商-点灰色研究传感器-柯达凯-0340 DX (1/3“640x480 CCD)分辨率- 648x484固件版本- 1.1.1.21固件建立时间-韦德6月21 :01:00 2006

错误跟踪:来源:.\IidcCameraInternal.cpp(429)构建:2010年9月23日12:41:46 -错误启动同步流。+->出发地:.\Iso.cpp(1515)建成:2010年9月23日12:41:43 -失败的等时启动。错误: 0x15。

代码语言:javascript
复制
    bool
Camera::Start()
{
    FlyCapture2::BusManager busMgr;
    unsigned int numCameras;
    error = busMgr.GetNumOfCameras(&numCameras);
    if (error != FlyCapture2::PGRERROR_OK)
    {
        error.PrintErrorTrace();
        return false;
    }
    FlyCapture2::PGRGuid guid;
    {
        error = busMgr.GetCameraFromIndex(0, &guid);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
    }


    // Connect to a camera
    error = cam.Connect(&guid);
    if (error != FlyCapture2::PGRERROR_OK)
    {
        error.PrintErrorTrace();
        return false;
    }

    // Get the camera information
    FlyCapture2::CameraInfo camInfo;
    error = cam.GetCameraInfo(&camInfo);
    if (error != FlyCapture2::PGRERROR_OK)
    {
        error.PrintErrorTrace();
        return false;
    }

    FlyCapture2::FC2Config Config;

    FlyCapture2::TriggerDelay Trigger;
    cam.GetTriggerDelay (&Trigger);
    Trigger.absValue = 0.000075;
    Trigger.onOff = true;
    error = cam.SetTriggerDelay (&Trigger);
    if (error != FlyCapture2::PGRERROR_OK)
    {
        error.PrintErrorTrace();
        return false;
    }
    FlyCapture2::StrobeControl s;
    {           
        FlyCapture2::TriggerMode Mode;
        memset (&Mode, 0, sizeof(Mode));
        Mode.source = 0;
        error = cam.GetTriggerMode (&Mode);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
        Mode.mode = 14;
        Mode.onOff = true;
        Mode.polarity = 1;
        error = cam.SetTriggerMode (&Mode);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
    }
    {
        FlyCapture2::Property p;
        memset (&p, 0, sizeof(p));
        p.type = FlyCapture2::AUTO_EXPOSURE;
        p.onOff = false;
        error = cam.SetProperty (&p);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
        memset (&p, 0, sizeof(p));
        p.type = FlyCapture2::BRIGHTNESS;
        p.absControl = true;
        p.absValue = Brightness;
        error = cam.SetProperty (&p);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
        memset (&p, 0, sizeof(p));
        p.type = FlyCapture2::SHUTTER;
        p.absControl = true;
        p.absValue = Shutter;
        p.onOff = false;
        error = cam.SetProperty (&p);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
        memset (&p, 0, sizeof(p));
        p.type = FlyCapture2::GAIN;
        p.absControl = true;
        p.absValue = Gain;
        p.onOff = false;
        error = cam.SetProperty (&p);
        if (error != FlyCapture2::PGRERROR_OK)
        {
            error.PrintErrorTrace();
            return false;
        }
        bool IsStandard = false;
        {
            error = cam.SetVideoModeAndFrameRate (FlyCapture2::VideoMode::VIDEOMODE_640x480Y8, FlyCapture2::FRAMERATE_60 );
            if (error != FlyCapture2::PGRERROR_OK)
            {
                error.PrintErrorTrace();
                return false;
            }
            FlyCapture2::Format7ImageSettings f7;
            memset (&f7, 0, sizeof(f7));
            f7.mode = FlyCapture2::MODE_0;
            float Percent = 1;
            f7.mode = FlyCapture2::MODE_0;
            f7.height = h;
            f7.width = w;
            f7.offsetX = 4+((640-w)/2);
            f7.offsetY = 2+((480-h)/2);
            f7.pixelFormat = FlyCapture2::PIXEL_FORMAT_MONO8;
            Percent = 100;
            bool Valid = false;
            FlyCapture2::Format7PacketInfo Info;
            error = cam.ValidateFormat7Settings  (&f7, &Valid, &Info);
            if (error != FlyCapture2::PGRERROR_OK)
            {
                error.PrintErrorTrace();
                return false;
            }           
            error = cam.SetFormat7Configuration (&f7, Info.recommendedBytesPerPacket);
            if (error != FlyCapture2::PGRERROR_OK)
            {
                error.PrintErrorTrace();
                return false;
            }
        }
    }
    cam.GetConfiguration  ( &Config);
    Config.grabTimeout = 4000;
    Config.numBuffers = 120;
    Config.grabMode = FlyCapture2::BUFFER_FRAMES;
    error = cam.SetConfiguration  ( &Config);
    if (error != FlyCapture2::PGRERROR_OK)
    {
        error.PrintErrorTrace();
        return false;
    }

    PrintCameraInfo(&camInfo);        

    // Start capturing images
    error = cam.StartCapture();
    if (error != FlyCapture2::PGRERROR_OK)
    {
        error.PrintErrorTrace();
        return false;
    }
}
EN

回答 2

Stack Overflow用户

发布于 2011-10-23 07:16:20

刚刚看到AndyUK的第4点,不确定这是否会帮助原来的海报。我需要一些关于返回的错误的额外信息。要有更多设置格式7的通用代码,您需要从摄像机中查询可用的步长。每种型号(以及可能的固件版本)都将支持偏移的步长和图像大小的步长。指定的偏移量和大小必须是这些步骤值的倍数。如果使用Camera.GetFormat7Info()获取信息,相关字段是offsetHStepSize、offsetVStepSize、imageHStepSize和imageVStepSize。我不确定,但听起来AndyUK的Flea2模型的值应该是8、2、8、2。偏移量和图像大小步骤不一定相同,尽管这很常见。

代码语言:javascript
复制
virtual Error GetFormat7Info( 
            Format7Info*   pInfo,
            bool*          pSupported );

/** Format 7 information for a single mode. */
struct Format7Info
{
        /** Format 7 mode. */
        Mode mode;

        /** Maximum image width. */
        unsigned int maxWidth;
        /** Maximum image height. */
        unsigned int maxHeight;
        /** Horizontal step size for the offset. */
        unsigned int offsetHStepSize;
        /** Vertical step size for the offset. */
        unsigned int offsetVStepSize;
        /** Horizontal step size for the image. */
        unsigned int imageHStepSize;
        /** Vertical step size for the image. */
        unsigned int imageVStepSize;
        /** Supported pixel formats in a bit field. */
        unsigned int pixelFormatBitField;

        /** Current packet size in bytes. */
        unsigned int packetSize;
        /** Minimum packet size in bytes for current mode. */
        unsigned int minPacketSize;
        /** Maximum packet size in bytes for current mode. */
        unsigned int maxPacketSize;
        /** Current packet size as a percentage of maximum packet size. */
            float percentage;
        /** Reserved for future use. */
        unsigned int reserved[16];

        Format7Info()
        {
            mode = MODE_0;
            maxWidth = 0;
            maxHeight = 0;
            offsetHStepSize = 0;
            offsetVStepSize = 0;
            imageHStepSize = 0;
            imageVStepSize = 0;
            pixelFormatBitField = 0;
            packetSize = 0;
            minPacketSize = 0;
            maxPacketSize = 0;
            percentage = 0.0f;
            memset( reserved, 0, sizeof(reserved) );
        }
    };
票数 2
EN

Stack Overflow用户

发布于 2011-09-28 13:47:54

只需澄清一两件事:

  1. 它是否经常这样做,即使你关闭和重新启动,拔掉火线等?
  2. 您是否尝试过运行随安装而来的Point提供的FlyCapture2 SDK示例?不管固件/ SDK更新如何,它们仍然运行良好吗?您似乎正在使用外部硬件触发器,所以您尝试过例如AsynchTriggerEx示例,当您输入软件触发器或外部硬件触发器时,这个示例仍然运行良好吗?或者可能尝试了FlyCap2MFC.exe的例子,只是为了检查它是否仍然捕获视频,好吗?
  3. 当您逐行执行代码时会发生什么情况?当它进入Start()时,您知道在什么时候开始出现麻烦吗?在哪一点上,库返回的“错误”值是一个不受欢迎的值,即不是每个摄像机函数应该返回的PGRERROR_OK值?
  4. 当我在Format7 (部分图像)模式下使用Format7摄像机时,对于MONO8模式下的图像,我注意到设置Format7ImageSettings结构的宽度时,除非该值为我的特定应用程序的8的倍数,否则ValidateFormat7Settings将返回FlyCapture2::Error value PGRERROR_IIDC_FAILED。同样,高度值也需要为2(偶数)的倍数,以确保满意的Format7设置。此错误将导致cam.StartCapture()函数挂起。

我不知道这最后一点是否已经记录在点灰色文献中,但只是一个观察。在第4点上,我可能弄错了。我仍然是FlyCapture的新手,还没有完全理解这一切。我欢迎有机会直截了当地谈这件事。

关于最后一点,这里

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

https://stackoverflow.com/questions/6640522

复制
相关文章

相似问题

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