0

Point Gray Research の Dragonfly Express カメラを数か月間使用しています。カメラを使用して画像を取得するコードを作成しました。最近、ファームウェアと SDK を 2 から 2.2 に更新しました。それ以来、コードを使用して画像を取得できませんでした。新しい FlyCapture2 コントロール パネル (2.2) が機能し、同じカメラを使用してビデオをキャプチャできます。具体的には、カメラ オブジェクトで StartCapture を呼び出すとエラーが発生します。プログラムからの出力を貼り付けています。その後、関連するカメラ コードを追加します。

* カメラ情報 * シリアル番号 - 7340769 カメラ モデル - Dragonfly Express DX-BW カメラ ベンダー - Point Grey Research センサー - Kodak KAI-0340DM (1/3" 640x480 CCD) 解像度 - 648x484 ファームウェア バージョン - 1.1.1.21 ファームウェア ビルド時間 - 水2006 年 6 月 21 日 23:01:00

エラー トレース: ソース: .\IidcCameraInternal.cpp(429) ビルド: 2010 年 9 月 23 日 12:41:46 - アイソクロナス ストリームの開始エラー。+-> から: .\Iso.cpp(1515) ビルド: 2010 年 9 月 23 日 12:41:43 - アイソクロナス スタートに失敗しました。エラー: 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;
    }
}
4

2 に答える 2

2

AndyUKのポイント4を見たばかりですが、これが元のポスターに役立つかどうかはわかりません。返されたエラーに関する追加情報が必要になります。フォーマット7を設定するためのより一般的なコードを取得するには、カメラから使用可能なステップサイズを照会する必要があります。各モデル(および場合によってはファームウェアバージョン)は、オフセットのステップサイズと、イメージサイズのステップサイズをサポートします。指定するオフセットとサイズは、これらのステップ値の倍数である必要があります。Camera.GetFormat7Info()を使用して情報を取得する場合、関連するフィールドはoffsetHStepSize、offsetVStepSize、imageHStepSize、およびimageVStepSizeです。よくわかりませんが、AndyUKのFlea2モデルの値は8、2、8、2のようです。オフセットと画像サイズのステップは、一般的ですが、必ずしも同じではありません。

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) );
        }
    };
于 2011-10-23T07:16:20.123 に答える
0

明確にするための1つまたは2つのこと:

  1. 電源を切って再起動したり、ファイヤーワイヤーを抜いたりしても、これは常に行われていますか?

  2. インストールに付属する Point Gray が提供する FlyCapture2 SDK サンプルを実行してみましたか? ファームウェア/SDK の更新に関係なく、正常に動作しますか? 外部ハードウェア トリガーを利用しているように見えるので、たとえば AsynchTriggerEx の例を試してみましたが、ソフトウェア トリガーまたは外部ハードウェア トリガーをフィードしても問題なく動作しますか? または、FlyCap2MFC.exe の例を試して、まだビデオが正常にキャプチャされていることを確認してください。

  3. コードを 1 行ずつ実行するとどうなるでしょうか。Start() に入ると、どの時点で問題が発生するか分かりますか? ライブラリによって返される「エラー」の値が望ましくない値、つまり各カメラ関数が返すべきPGRERROR_OK値ではないのはどの時点ですか?

  4. Flea2 カメラを Format7 (部分画像) モードで使用したとき、MONO8 モードの画像に対して、Format7ImageSettings 構造体の幅を設定するときよりも気付きました。特定のアプリケーションでこの値が8 の倍数でない限り、ValidateFormat7Settings が返されます。 FlyCapture2::Error 値 PGRERROR_IIDC_FAILED。同様に、満足できる Format7 設定を確保するには、高さの値も2 の倍数(偶数) である必要がありました。このエラーにより、cam.StartCapture() 関数がハングします。

その最後の点がすでにポイントグレイの文献に記載されているかどうかはわかりませんが、単なる観察です. ポイント 4 で間違っている可能性があります。私はまだ FlyCapture の初心者であり、まだすべてを完全に理解していません。私はこれにまっすぐに置かれる機会を歓迎します.

最後のポイントについて詳しくは、こちらをご覧ください。

于 2011-09-28T13:47:54.967 に答える