开发者

Cannot start capture on PTGRey camera(Dragonfly express) after updaing firmware\SDK

开发者 https://www.devze.com 2023-03-19 08:28 出处:网络
I have been using a Dragonfly Express camera from Point Grey Research for a few months. I have written code to use the camera and grab images with it.

I have been using a Dragonfly Express camera from Point Grey Research for a few months. I have written code to use the camera and grab images with it. Lately I have updated the firmware and SDK from 2 to 2.2, since then I was unable to grab images using my code. The new FlyCapture2 control panel(2.2) works and is able to capture video using the same camera. Specifically, I am getting an error when I call StartCapture on the Camera object. I am pasting the output from my program, and I will add the relevant camera code afterwards:

* CAMERA INFORMATION * Serial number - 7340769 Camera model - Dragonfly Express DX-BW Camera vendor - Point Grey Research Sensor - Kodak KAI-0340DM (1/3" 640x480 CCD) Resolution - 648x484 Firmware version - 1.1.1.21 Firmware build time - Wed Jun 21 23:01:00 2006

Error Trace: Source: .\IidcCameraInternal.cpp(429) Built: Sep 23 2010 12:41:46 - Error starti ng isochronous stream. +-> From: .\Iso.cpp(1515) Built: Sep 23 2010 12:41:43 - Failed isochronous start . Error: 0x15.

    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.PrintE开发者_C百科rrorTrace();
        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;
    }
}


Just saw AndyUK's point 4, not sure if this will help the original poster though. I would need some additional information about the error that's returned. To have more general code for setting format 7 you'll want to query the available step sizes from the camera. Each model (and potentially firmware version) will support a step size for offsets and and a step size for image size. The offset and size specified must be a multiple of these step values. If you pull the info with Camera.GetFormat7Info() the relevant fields are offsetHStepSize, offsetVStepSize, imageHStepSize, and imageVStepSize. I'm not sure but it sounds like the values for AndyUK's Flea2 model would be 8, 2, 8, 2. The offset and image size steps are not necessarily the same although that's common.

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) );
        }
    };


Just one or two things to clarify:

  1. Is it doing this constantly, even if you power down and restart, unplug the firewire etc?

  2. Have you tried running the FlyCapture2 SDK examples provided by Point Gray that come with your installation? Do they still run fine regardless of the firmware / SDK updates? You appear to be utilizing external hardware triggers so have you tried for example the AsynchTriggerEx example and this still runs fine when you feed it software triggers or external hardware triggers? Or maybe tried the FlyCap2MFC.exe example just to check that it still captures video OK?

  3. What happens when you step though the code line-by-line? When it enters Start() do you know at which point the trouble starts? At what point is the value of "error" returned by the library an undesirable one i.e. not the PGRERROR_OK value each camera function should be returning?

  4. When I've used a Flea2 camera in Format7 (partial image) mode, for images in MONO8 mode, I noticed than when setting the width for the Format7ImageSettings struct, unless this value is a multiple of 8 for my particular application then ValidateFormat7Settings would return the FlyCapture2::Error value PGRERROR_IIDC_FAILED. Similarly the height values also needed to be multiple of 2 (even) to ensure a satisfactory Format7 setting. This error would cause the cam.StartCapture() function to hang.

I don't know if that last point is already documented in the Point Grey literature, but just an observation. I might be mistaken on point 4. I am still a novice in FlyCapture and don't fully understand all of it yet. I would welcome the chance to be put straight on this.

More on that last point here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号