From 78616ff2036ddb025ad55bd822c8fda6fa86668a Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sat, 16 Mar 2024 15:29:35 -0400 Subject: [PATCH] Continue loop if frame Mat is empty --- opencv_fb.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opencv_fb.cpp b/opencv_fb.cpp index 0dad5a2..b2547b3 100644 --- a/opencv_fb.cpp +++ b/opencv_fb.cpp @@ -74,7 +74,7 @@ void display (Mat frame, framebuffer_info fb_info, ofstream& ofs) { } } break; default: - cerr << "Unsupported depth of framebuffer." << endl; + cerr << "Unsupported depth of framebuffer: " << framebuffer_depth << endl; } } } @@ -111,6 +111,9 @@ int main(int, char**) { Mat displayFrame; while (true) { cap >> frame; + if (frame.empty()) { + continue; + } frame = frameEffects(frame); resize(frame, displayFrame, Size(fb_info.xres_virtual, fb_info.yres_virtual), 2, 2, INTER_CUBIC); display(displayFrame, fb_info, ofs);