qq_44431710 2019-10-15 16:04 采纳率: 0%
浏览 1555

videocapture 抓拍图片报警missing picture in access unit 是什么原因呀

这是报警信息图片说明

这是抓图代码

int CaptureJpg(const string& curl)
{
    if (curl.empty())
    {
        TextLog::Singleton().Write("log.log", "url empty");
        return -1;
    }   
    string ip;
    GetIP(curl, ip);//从Rtsp流地址中获取ip
    if (!ping(ip))//检测网络
    {
        TextLog::Singleton().Write("log.log", "Camera connection failed");
        return -1;
    }

    cout << curl << endl;
    VideoCapture cap(curl);
    if (!cap.isOpened())
    {
        return -1;
    }
        Mat frame;
        string fname;
        time_t milsecond;
        time(&milsecond);
        fname = to_string(milsecond) + ".jpg";
        if (cap.read(frame))
        {
            //imshow("Video", image);
            if (frame.empty())
            {
                TextLog::Singleton().Write("log.log", "frame empty");
                return -1;
            }
            TextLog::Singleton().Write("log.log", fname);
            vector<int> compression_params;
            compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);  //选择jpeg 
            compression_params.push_back(30); //在这个填入你要的图片质量
            imwrite(fname.c_str(), frame, compression_params);
            DataCenter::Singlon().SetCameraljpg(fname); 
            frame.release();
        }
    cap.release();
    return 0;
}
  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀