Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement a circular buffer of cv::Mat objects (OpenCV)?

I'm trying to implement a circular buffer for my program. The buffer is used to share data between two threads as shown below. I use OpenCV to grab video frames from camera (Thread 1). Then I would like to store this data in a circular buffer, so that Thread 2 can get the data from the buffer.

enter image description here

How can I implement a circular buffer for cv::Mat objects in C++? I know how to create circular buffer for standard C++ objects (like int or char) but I can't make it work with objects of type cv::Mat.

Any suggestions?

like image 861
Alexey Avatar asked Feb 27 '12 21:02

Alexey


1 Answers

Solved, see Thread safe implementation of circular buffer

like image 87
Alexey Avatar answered Sep 26 '22 12:09

Alexey