Ожидаемое поведение:
- Кадр обработки «» постоянно печатается и не блокируется.
- ФункцияtreatImage вызывается каждые ~100 мс с использованием изображения из кадра
Код: Выделить всё
std::condition_variable cvar;
std::atomic_bool done(false);
std::atomic_bool predicate(false);
std::mutex mutex;
Код: Выделить всё
void readVideo(const std::string& filename, cv::Mat& frame_) {
cv::VideoCapture cap(filename, cv::CAP_FFMPEG);
if (!cap.isOpened()) {
std::cerr
Подробнее здесь: [url]https://stackoverflow.com/questions/78438144/stdcondition-variable-between-two-threads-read-treat[/url]