Continue loop if frame Mat is empty

This commit is contained in:
Matt McWilliams 2024-03-16 15:29:35 -04:00
parent 835d509da5
commit 78616ff203
1 changed files with 4 additions and 1 deletions

View File

@ -74,7 +74,7 @@ void display (Mat frame, framebuffer_info fb_info, ofstream& ofs) {
} }
} break; } break;
default: 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; Mat displayFrame;
while (true) { while (true) {
cap >> frame; cap >> frame;
if (frame.empty()) {
continue;
}
frame = frameEffects(frame); frame = frameEffects(frame);
resize(frame, displayFrame, Size(fb_info.xres_virtual, fb_info.yres_virtual), 2, 2, INTER_CUBIC); resize(frame, displayFrame, Size(fb_info.xres_virtual, fb_info.yres_virtual), 2, 2, INTER_CUBIC);
display(displayFrame, fb_info, ofs); display(displayFrame, fb_info, ofs);