We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int main() { // 加载图像
// std::string video_path = "/data/ai_monitor/simulate/video/channels/1"; std::string video_path = "rtsp://admin:antong%40%21%40%23%24@192.168.1.88:554/h264/ch0/main/av_stream"; std::shared_ptrcv::Mat mat_; std::shared_ptrcv::VideoCapture cap = nullptr; cap = std::make_sharedcv::VideoCapture(video_path, cv::CAP_ANY); // VideoCapture cap(video_path,CAP_ANY);
if (!cap->isOpened() || cap == nullptr) { std::cout <<"open faild !" << std::endl; return -1; }
int frame_cout = 0; mat_ = std::make_sharedcv::Mat(); while (true) { if (!cap->read(*mat_)) { break; } auto now = std::chrono::system_clock::now(); auto time_point = std::chrono::system_clock::to_time_t(now); std::stringstream ss; ss << std::put_time(std::localtime(&time_point), "%H:%M:%S"); std::string formatted_time = ss.str(); std::cout << formatted_time << std::endl; std::string filename = "./image/" + formatted_time + "" + std::to_string(frame_cout) + ".jpg"; std::string filename = "./image/" + std::to_string(frame_cout) + ".jpg"; imwrite(filename,*mat); frame_cout++; } cap->release(); return 0; } 这样读取实时视频咋存在延迟呢,直接用VLC拉流是正常的
The text was updated successfully, but these errors were encountered:
No branches or pull requests
int main() {
// 加载图像
// std::string video_path = "/data/ai_monitor/simulate/video/channels/1";
std::string video_path = "rtsp://admin:antong%40%21%40%23%24@192.168.1.88:554/h264/ch0/main/av_stream";
std::shared_ptrcv::Mat mat_;
std::shared_ptrcv::VideoCapture cap = nullptr;
cap = std::make_sharedcv::VideoCapture(video_path, cv::CAP_ANY);
// VideoCapture cap(video_path,CAP_ANY);
if (!cap->isOpened() || cap == nullptr)
{
std::cout <<"open faild !" << std::endl;
return -1;
}
int frame_cout = 0;
mat_ = std::make_sharedcv::Mat();
while (true)
{
if (!cap->read(*mat_))
{
break;
}
auto now = std::chrono::system_clock::now();
auto time_point = std::chrono::system_clock::to_time_t(now);
std::stringstream ss;
ss << std::put_time(std::localtime(&time_point), "%H:%M:%S");
std::string formatted_time = ss.str();
std::cout << formatted_time << std::endl;
std::string filename = "./image/" + formatted_time + "" + std::to_string(frame_cout) + ".jpg";
std::string filename = "./image/" + std::to_string(frame_cout) + ".jpg";
imwrite(filename,*mat);
frame_cout++;
}
cap->release();
return 0;
}
这样读取实时视频咋存在延迟呢,直接用VLC拉流是正常的
The text was updated successfully, but these errors were encountered: