This commit is contained in:
bmy
2024-07-01 01:30:45 +08:00
parent 4b33e55c57
commit 564fd4439f
3 changed files with 25 additions and 12 deletions

View File

@@ -70,6 +70,7 @@ void capture::run(void)
*cap >> frame;
if (frame.empty())
{
// TODO 尝试返回缓存帧,并重新启动 capture
log_error("empty frame");
break;
}
@@ -79,14 +80,15 @@ void capture::run(void)
{
frame = frame.clone().reshape(1, frame.total());
}
// 中心翻转处理
if (flip)
{
cv::flip(frame, frame, -1);
// cv::flip(frame, frame, 1);
}
cv::cvtColor(frame, dst, cv::COLOR_BGR2RGB);
// cv::imshow(zmq_bind_addr, frame);
// 将图像转换为 rgb
cv::cvtColor(frame, dst, cv::COLOR_BGR2RGB);
// 将帧编码后发送
std::vector<uchar>
@@ -112,6 +114,8 @@ void capture::run(void)
cv::waitKey(1);
// usleep(20000);
}
log_error("capture exit");
}
bool capture::is_open(void)