我对以下代码有问题
namespace MyApp
{    
    public partial class PhotoWindow : Window
    {
        private Capture _capture;
        public PhotoWindow ()
        {
            InitializeComponent();    
            _capture = new Capture();
            if (_capture != null)
            {
                //<Image> in XAML
                CaptureSource.Width = 150;
                CaptureSource.Height = 180;
                _capture.ImageGrabbed += ProcessFrame;
                _capture.Start();                
            }
            Activated += (s, e) => _capture.Start();
            Closing += (s, e) =>
            {
                if (_capture == null) return;
                _capture.Stop();                
                _capture.Dispose();
            };
        }
        private void ProcessFrame(object sender, EventArgs e)
        {
            try
            {
                Image<Bgr, Byte> frame = _capture.RetrieveBgrFrame();                   
                CaptureSource.Source = Helper.ToBitmapSource(frame);
            }
            catch (Exception exception)
            {
                System.Windows.MessageBox.Show(exception.ToString());
            }
        }
    }
}
当我运行应用程序时,我System.InvalidOperationException: The thread that this call can not access this object because the owner is another thread在线得到异常CaptureSource.Source = Helper.ToBitmapSource(frame);
因为我可以解决这个问题?