質問

ようにしている設定motiondetectionのAForge.NET 枠組みを使用している情報の提供 この ページです。

私の設定は、適videostreamるフィードの一部をデスクトップを通じてストリームです。選べまこのストリームのサンプルvideoplayerプロジェクトを提供していAForge.(日本は、私のデスクトップを通じてのプレイヤー).

しかし、実行し以下のコードを受けていNullReferenceException.と思欠?

    // New frame received by the player
    private void videoSourcePlayer_NewFrame( object sender, ref Bitmap image )
    {
        if (this.detector.ProcessFrame(image) > 0.02)
        {
            Console.WriteLine("Motion");
        }
        else
        {
            Console.WriteLine("No motion");
        }
    }

detector 初期化としてのプライベートクラス変数の場合videostreamを選択します。

    private MotionDetector detector;
    private BlobCountingObjectsProcessing motionProcessor;

    // Open video source
    private void OpenVideoSource( IVideoSource source )
    {
        BlobCountingObjectsProcessing motionProcessor = new BlobCountingObjectsProcessing();

        MotionDetector detector = new MotionDetector(
            new SimpleBackgroundModelingDetector(),
            motionProcessor);
    }
役に立ちましたか?

解決

というものが BlobCountingObjectsProcessing motionProcessor, そうでんを宣言した変数回初期化されず、一度初期化されます。

社外の方法範囲および内部の方法です。

と思いるNullReferenceException。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top