简体   繁体   中英

C# WPF - Camera capture from DLL

I'm using AForge.NET library to capture USB Camera, I need that piece of code to be on a DLL. For each frame the AForge.NEt library create an event with a bitmap, I'm trying to bubble up this event to my main WPF window, for this I created a simple event in the DLL library so the main app can init this event. but I'm getting "The calling thread cannot access this object because a different thread owns it." I'm using

Dispatcher.Invoke(() => 
   {
       imgCamera.Source = newFrame;
   });

still the same message. any idea?

I found the solution after spending on it so many time. just do -> newFrame.Freeze();

it takes of all thread issues

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM