Inheritance: ISampleGrabberCB, INotifyPropertyChanged
        /// <summary>;
        /// Starts grabbing images from the capture device
        /// </summary>
        public void Start()
        {
            // First check if we have a valid moniker string
            if (string.IsNullOrEmpty(_monikerString))
            {
                return;
            }

            // Check if we are already running
            if (IsRunning)
            {
                // Yes, stop it first
                Stop();
            }

            // Create new grabber
            _capGrabber = new CapGrabber();
            _capGrabber.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(capGrabber_PropertyChanged);
            _capGrabber.NewFrameArrived += new EventHandler(capGrabber_NewFrameArrived);

            // Create manual reset event
            _stopSignal = new ManualResetEvent(false);

            // Start the thread
            _worker = new Thread(RunWorker);
            _worker.Start();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Releases the capture device
        /// </summary>
        private void Release()
        {
            // Stop the thread
            _worker = null;

            // Clear the event
            if (_stopSignal != null)
            {
                _stopSignal.Close();
                _stopSignal = null;
            }

            if (_graph != null)
            {
                _graph.Abort();
                _graph.Disconnect(_sourceObject.GetPin(PinDirection.Output, 0));
                _graph.Disconnect(_grabberObject.GetPin(PinDirection.Input, 0));
                _graph.RemoveFilter(_sourceObject);
                _graph.RemoveFilter(_grabberObject);
            }

            // Clean up
            _graph         = null;
            _sourceObject  = null;
            _grabberObject = null;
            _grabber       = null;
            _capGrabber    = null;
            _control       = null;
        }
        /// <summary>
        /// Releases the capture device
        /// </summary>
        private void Release()
        {
            // Stop the thread
            _worker = null;

            // Clear the event
            if (_stopSignal != null)
            {
                _stopSignal.Close();
                _stopSignal = null;
            }

            // Clean up
            _graph         = null;
            _sourceObject  = null;
            _grabberObject = null;
            _grabber       = null;
            _capGrabber    = null;
            _control       = null;
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Releases the capture device
        /// </summary>
        private void Release()
        {
            // Stop the thread
            Worker = null;

            // Clear the event
            if (StopSignal != null)
            {
                StopSignal.Close();
                StopSignal = null;
            }

            // Clean up
            Graph = null;
            SourceObject = null;
            GrabberObject = null;
            Grabber = null;
            CapGrabber = null;
            Control = null;
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     ;
        ///     Starts grabbing images from the capture device
        /// </summary>
        public void Start()
        {
            // First check if we have a valid moniker string
            if (string.IsNullOrEmpty(_monikerString)) return;

            // Check if we are already running
            if (IsRunning)
            {
                // Yes, stop it first
                Stop();
            }

            // Create new grabber
            CapGrabber = new CapGrabber();
            CapGrabber.PropertyChanged += capGrabber_PropertyChanged;
            CapGrabber.NewFrameArrived += capGrabber_NewFrameArrived;

            // Create manual reset event
            StopSignal = new ManualResetEvent(false);

            if (Worker == null)
            {
                // Start the thread
                Worker = new Thread(RunWorker);
                Worker.Start();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Releases the capture device
        /// </summary>
        private void Release()
        {
            // Stop the thread
            _worker = null;

            // Clear the event
            if (_stopSignal != null)
            {
                _stopSignal.Close();
                _stopSignal = null;
            }

            // Clean up
            _graph = null;
            _sourceObject = null;
            _grabberObject = null;
            _grabber = null;
            _capGrabber = null;
            _control = null;
        }
Ejemplo n.º 7
0
        /// <summary>;
        /// Starts grabbing images from the capture device
        /// </summary>
        public void Start()
        {
            // First check if we have a valid moniker string
            if (string.IsNullOrEmpty(_monikerString)) return;

            // Check if we are already running
            if (IsRunning)
            {
                // Yes, stop it first
                Stop();
            }

            // Create new grabber
            _capGrabber = new CapGrabber();
            _capGrabber.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(capGrabber_PropertyChanged);
            _capGrabber.NewFrameArrived += new EventHandler(capGrabber_NewFrameArrived);

            // Create manual reset event
            _stopSignal = new ManualResetEvent(false);

            // Start the thread
            _worker = new Thread(RunWorker);
            _worker.Start();
        }