c# 窗体最小化再弹出后读不到下一帧

zg_vera 2017-05-08 11:08:32
rtsp方式调用的海康摄像头,读摄像头的时候用了事件
public void Form1_Load(object sender, EventArgs e)
{
Form1.CheckForIllegalCrossThreadCalls = false;
readVideo();

public void readVideo()
{
if (cap != null)
{
Application.Idle += new EventHandler(ProcessFram);

}
.....
}

private void ProcessFram(object sender, EventArgs arg)
{

var frame = cap.QueryFrame();
SetImage(frame);

}
窗体最小化几分钟后,再弹出窗体,就走了下面的if语句,frame成了null,视频窗体就成了白板,再也不能正常显示了
public void SetImage(Mat img)
{

if (img == null)
setImage(pictureBox1, null);
.....
}
一直没有找到解决的方法,曾经考虑过picturebox控件问题、线程问题(界面作为子线程)、视频码流断了等原因,都没有解决,急需大神指导!!!
...全文
430 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zg_vera 2017-10-27
  • 打赏
  • 举报
回复
没人....

4,448

社区成员

发帖
与我相关
我的任务
社区描述
图形图像/机器视觉
社区管理员
  • 机器视觉
  • 迪菲赫尔曼
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧