首页 新闻 赞助 找找看

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

0
悬赏园豆:200 [待解决问题]

是通过Rtsp流地址抓拍的图片 运行一段时间后就会出现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;

}

十只小白白的主页 十只小白白 | 初学一级 | 园豆:2
提问于:2019-10-15 16:16
< >
分享
所有回答(1)
0

你说的我不清楚 但是我碰到类似的情况 抓包后蜘蛛爬行网页参数时候出现返回值异常 原因是 ip受限

解决方法是 某宝购 动态vps 软件加换ip pppoe拨号功能 出现上述情况 后 换ip 清理cookies 再试就可以了

仅供你参考

猫也要做大王 | 园豆:94 (初学一级) | 2019-11-13 05:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册