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

Ofer picture Ofer · Jul 10, 2011 · Viewed 8.9k times · Source

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

Answer

Matt picture Matt · Oct 23, 2011

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