fix webcam crash when failed to read video frame (#21272)

local_plotjuggler
Dean Lee 2021-06-15 18:25:05 +08:00 committed by GitHub
parent a23584b6e2
commit 73d741b7be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -79,6 +79,8 @@ void run_camera(CameraState *s, cv::VideoCapture &video_cap, float *ts) {
while (!do_exit) {
cv::Mat frame_mat, transformed_mat;
video_cap >> frame_mat;
if (frame_mat.empty()) continue;
cv::warpPerspective(frame_mat, transformed_mat, transform, size, cv::INTER_LINEAR, cv::BORDER_CONSTANT, 0);
s->buf.camera_bufs_metadata[buf_idx] = {.frame_id = frame_id};