class SimpleCamera
{
private:
ImagePtr* image
std::mutex lock;
public:
void StartGrabing();
void OnImageGrabbed(ImagePtr* frame); //EventHandler Function
};
void SimpleCamera::OnImageGrabbed(ImagePtr* frame)
{
mLock.lock();
image = frame;
mLock.unlock();
//Fire the managed/C# event
}
The OnImageGrabbed is event handler function which is called each time frame is available. I am supposed to use this frame to display an image on GUI which is written in C#. However, the restriction from camera vendor is that I cannot access UI objects in this function.
The way I was planning to display an image on C# GUI is that I would like to trigger an event in C# code from within OnImageGrabbed() function(native C++ code) which will in turn access the ImagePtr in C++, copy the data over and display on the C# GUI. I have the copying the data over figured out but not triggering the event.
How can I do this?
Aucun commentaire:
Enregistrer un commentaire