C# WPF - Camera capture from DLL

557 views Asked by At

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?

1

There are 1 answers

0
Kulpemovitz On

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

it takes of all thread issues