I need to save image, which is already displayed in cvNamedWindow. The problem is that the source image may already be changed, so I need to fetch it somehow from the window.
As an alternative solution, currently displayed frame can be saved in IplImage object, but maybe someone knows how to get IplImage directly from cvNamedWindow?
Thanks in advance.
PS. Using opencv in c++ project.
I need to save image, which is already displayed in cvNamedWindow. The problem is
Share
If you need to do that, you got it all wrong.
Let’s assume you are working with a multithread application that captures the frame in the 1st thread, and displays them with
cvNamedWindow()in the 2nd thread. In this case, you need to to prevent the frame from being accessed by those 2 threads simultaneously: investigate mutexes.In case your application has only one thread, all you need to do is execute
cvWriteFrame()right before thecvNamedWindow()call to save the frame to the disk, or copy the frame to anotherIplImageusing:Just don’t forget to release the image after you’ve done with it to free allocated resources.